I'm using Angular UI Tree to show a TreeView. To request all nodes to a REST API, I use restangular to return a list of nodes.
But, Angular UI Tree uses this data structure:
[
{
"id" : 1,
"nodes": [
{
"id" : 11
}
]
},
{
"id" : 2,
"nodes": [
{
"id" : 21
}
]
}
]
And I want it to use:
[
{"id" :1, parent : ""},
{"id" :2, parent : ""},
{"id" :21, parent : "2"},
{"id" :11, parent : "1"}
]
How can I do that on template?
I'm using this.
Is there any other way to request an array of nodes and to use that in UI Tree where each node is a Restangular object?