树形结构,模板递归
ng-include 巨坑啊:ng-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>