If we will add to HTML: <pre>{{currentNode|json}}</pre>
we can see:
{
"roleName": "subUser2-1-1",
"roleId": "role1211",
"children": [],
"selected": "selected"
}
Now the roleId
is unique, in our case its role1211
where 1211
represents parent indexes:
root -> 1 -> 2 -> 1 -> 1
By this way its pretty easy to write single method that runs in loop on tree model and fetch child according to root -> 1 -> 2 -> 1 -> 1