I have a nodeJSON string like
{
"Name": "Addition",
"Id": "3",
"ParentId": "1",
"children": [
{
"Name": "Two Numbers",
"Id": "5",
"ParentId": "3",
"children": []
},
{
"Name": "Three Numbers",
"Id": "6",
"ParentId": "3",
"children": []
}
]
}
I get a parentId as 3 then i want to display the Key value name as "Addition" which should be matched with its Id.
{
"Name": "Addition",
"Id": "3",
"ParentId": "1",
"children": [....]
}
myApp.controller('leafController', function($scope){
$scope.getname = function(parentid,nodeJSON )
{
//parentid is 3 here
$scope.Id = parentid;
$scope.data = nodeJSON ;
// i want to get name according to id
// Name : Addition (if Id is 3)
};
});
I am struck here.
Please help me,
thanks in advance