I made a recursive ng-repeat element, and trying to manipulate things has turned into a nightmare, because I don\'t have reference to the parent I\'m iterating over.
The
I would stay away from Angular's $parent
and all the $scope
creation and inheritance madness. What you need is to keep a reference to the parent object, not finding how many scopes are in-between ng-include
's and ng-repeat
's and juggling with $parent.$parent
. My suggestion is to explicitly save references to the values you are interested in, just implement it yourself with custom logic. For example, if you want to expose a value from the parent ng-repeat to the child ng-repeat
Then in your javascript code you can access all parents recursively
function doSomething(value){
parent1 = value._parent;
parent2 = parent1._parent;
}
Same code with ng-include