I\'m trying to generate an n-level hierarchical unordered list with anugularJS, and have been able to successfully do so. But now, I\'m having scope issues between the directiv
Please have a look at this working fiddle, http://jsfiddle.net/eeuSv/
What i did was to require the parent controller inside the navtree-node
directive, and call a member function defined in that controller.
The member function is setSelected
. Please note that its this.setSelected
and not $scope.setSelected
.
Then define a navtree-node
scope method itemSelect
. While you click on the anchor tags, it will call the itemSelect
method on the navtree-node
scope. This inturn will call the controllers member method setSelected
passing the selected id.
scope.itemSelect = function(id){
myGreatParentControler.setSelected(id)
}