I'm currently implementing a recursive directive called https://github.com/dotJEM/angular-tree to iterate through a model structure like the one below:
$scope.model = [
{
label: 'parent1',
children: [{
label: 'child'
}]
},
{
label: 'parent2',
children: [{
label: 'child',
children: [{
label: 'innerChild'
}]
}]
},
{
label: 'parent3'
}
];
This is how the code appears in the template:
<div data-dx-start-with="model">
<div data-ng-repeat="node in $dxPrior">
<a class="list-group-item">
<span class="icon" data-ng-click="toggle(node)"><i class=" icon ion-android-arrow-dropdown"></i> </span>
<span>{{ node.label}} ({{node.children.length}})</span>
</a>
<ul data-ng-show="node.expanded" data-dx-connect="node.children"></ul>
</div>
</div>
I am looking for a way to access each parent in order to construct a breadcrumb navigation path of the treeview.
Example: parent2 > child > innerChild > ...
While I can retrieve a single node's parent using $parent, my goal is to obtain all parents. Any ideas on achieving this?
To demonstrate my point further, I've put together a plunker demo: http://plnkr.co/edit/DOc9k4jT9iysJLFvvg3u?p=preview