0
我正在使用Angular UI樹來實現項目類別關係,在默認實現中一切正常,但現在需要獲取節點/節樹中的數字來管理層次結構。獲取Angualr UI樹中的節點號[angular-ui-tree]
我跟進This Codepen模板得到的數量,但不幸的是,我沒有得到期望的輸出
<div id="template" class="collapse fade ">
<div class="row">
<div class="col-sm-12">
<div ui-tree id="tree-root">
<ol ui-tree-nodes="" ng-model="data">
<li ng-repeat="node in data" ui-tree-node ng-click="nodeClicked(node)">
<div class="tree-node tree-node-content">
<i ui-tree-handle class="fa fa-bars"></i>
<a class="btn btn-success btn-xs" ng-if="node.nodes && node.nodes.length > 0" data-nodrag ng-click="toggle(this)">
<span class="glyphicon" ng-class="{
'glyphicon-chevron-right': collapsed,
'glyphicon-chevron-down': !collapsed
}"></span>
</a>
<a editable-text="node.title" class="gg-editable-a" > </a>
<a class="pull-right btn btn-primary btn-xs" data-nodrag ng-click="newSubItem(this)" style="margin-right: 8px;">
<span class="glyphicon glyphicon-plus"></span></a>
</div>
<ol ui-tree-nodes="" ng-model="node.nodes" ng-class="{hidden: collapsed}" >
<li ng-repeat="node in node.nodes" ui-tree-node ng-click="nodeClicked(node)">
<div class="tree-node tree-node-content">
<i ui-tree-handle class="fa fa-bars"></i>
<a class="btn btn-success btn-xs" ng-if="node.nodes && node.nodes.length > 0" data-nodrag ng-click="toggle(this)">
<span class="glyphicon" ng-class="{
'glyphicon-chevron-right': collapsed,
'glyphicon-chevron-down': !collapsed
}"></span>
</a>
<a editable-text="node.title" class="gg-editable-a" > </a>
<a class="pull-right btn btn-danger btn-xs" data-nodrag ng-click="remove(this)">
<span class="glyphicon glyphicon-remove"></span></a>
</div>
</li>
</ol>
</li>
</ol>
</div>
</div>
<div class="col-sm-6 hidden ">
<div class="info">
@{{info}}
</div>
<input class="hidden" name='meetingSections' id='meetingSections' value="@{{ data | json }}" />
</div>
</div>
和我得到下面的輸出。