I'm using the ui-tree in angularjs. For binding I use a method which gives me the child elements:
<div ui-tree="treeOptions">
<ol ng-init="children=getChildren(website.id, '0')" ng-model="children" ui-tree-nodes>
<li ng-repeat="node in children" data-collapsed="node.isCollapsed" ui-tree-node ng-include="'nodeTemplate.html'" ng-cloak></li>
</ol>
</div>
With ng-init
I initialize the children array for further usage. This code works, but ng-init
is not reevaluated when data changes. So dynamically adding a new item is not possible. Is there a way of setting a local variable in HTML similar to ng-init
that gets refreshed automatically?