樹形結構,模板遞歸

樹形結構,模板遞歸

ng-include 巨坑?。簄g-include=" ' abc.html ' " 或是script模板的id,但是要有單引號啊?。。。。。?!

http://jsfiddle.net/brendanowen/uXbn6/8/

<script type="text/ng-template" id="tree_item_renderer.html">

{{data.name}}

<button ng-click="add(data)">Add node</button>

<button ng-click="delete(data)" ng-show="data.nodes.length > 0">Delete nodes</button>

<ul>

    <li ng-repeat="data in data.nodes" ng-include="'tree_item_renderer.html'"></li>

</ul>

<ul ng-app="Application" ng-controller="TreeController">

<li ng-repeat="data in tree" ng-include="'tree_item_renderer.html'"></li>

</ul>

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。

推薦閱讀更多精彩內容