I have an application that has set of data that has a recursive relationship (a tree view, using recursion.) I\'ve tried several ways to implement this via Angular, none of
rather than nest your controllers, nest the data and just have the one controller.
the view is handled by a template that references itself recursively.
as chadermani has linked to, there are some answers out there.
here is a fiddle with a great example (not my code)
http://jsfiddle.net/brendanowen/uXbn6/8/
and the code from the fiddle
angular.module("myApp", []).
controller("TreeController", ['$scope', function($scope) {
$scope.delete = function(data) {
data.nodes = [];
};
$scope.add = function(data) {
var post = data.nodes.length + 1;
var newName = data.name + '-' + post;
data.nodes.push({name: newName,nodes: []});
};
$scope.tree = [{name: "Node", nodes: []}];
}]);