我有这个代码http://plnkr.co/edit/kiH0Ge?p=preview
<!doctype html>
<html ng-app="plunker" >
<head>
<meta charset="utf-8">
<title>AngularJS Plunker</title>
<link rel="stylesheet" href="style.css">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.1/angular.js"></script>
<script src="app.js"></script>
</head>
<body ng-controller="MainCtrl">
<choice-tree ng-model="myTree" children="true"></choice-tree>
<hr />
$scope.myTree = {{myTree | json}}
</body>
</html>
我添加了参数 checkChildren
<choice-tree ng-model="myTree" checkChildren="true"></choice-tree>
然后在检查指令中我想有条件地运行函数
if(scope.checkChildren === 'true')
checkChildren(choice);
但它不起作用。
我知道有孤立的范围,但是如何构建树。