Set a local variable in HTML like ng-init

I am using ui-tree in angularjs. For the binding, I use the method that gives me the children:

<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>

      

C ng-init

I am initializing the child array for later use. This code works, but is ng-init

not reevaluated when data changes. Therefore, it is not possible to dynamically add a new item. Is there a way to set a local variable in HTML similar to ng-init

that which is automatically updated?

+3


source to share





All Articles