Is it possible to get the specific scope of an object by accesing it through an ID?
I use angular ui tree for a navigation menu. After I add a subitem and save the navigation into a mysql database, the node with the subitem is not expanded. After the push, I see that the menu expands, but after saving it in the database and rerendering the navigation menu, the node is not expanded.
Have someone a solution?
JSON-Object of the menu.
[
{
"id": 35,
"title": "foo",
"items": []
},
{
"id": 34,
"title": "bar",
"items": [
{
"id": 123,
"title": "foobar",
"items": []
},
]
},
{
"id": 46,
"title": "barfoo",
"items": []
},
]
This structure is saved with the following code
function setMenu(nodeID) {
$http.post("...", {
"menuJSON" : $scope.menu
}).success(function (data, status, headers, config) {
if (status == 200) {
loadAdminNavigation();
}
});
};
After saving it in the mysql database, the structure is reloaded with this code
function loadAdminNavigation() {
$http.get("...").success(function (response) {
$scope.menu = response;
});
};
If I add a SubItem, all scopes are new, I want to expand the node with the ID from the model. So I need to know how I can access the scope via the ID.