【发布时间】:2015-08-15 20:22:05
【问题描述】:
我创建了这个小提琴来显示我的问题...
我将一个新创建的数组传递给一个指令,一切正常。但是,我在控制台窗口中收到一条错误消息:
Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
对我需要按摩什么来清理这个有什么想法吗?我希望能够重用指令而不需要更新控制器。
这里是html
<body ng-app="myApp">
<test-dir fam-people='[1,4,6]'> </test-dir>
<test-dir fam-people='[2,1,0]'> </test-dir>
</body>
这里是 JS。
var myApp = angular.module('myApp', []);
myApp.directive('testDir', function() {
return { restrict: 'E'
, scope: { famPeople: '=famPeople' }
, template: "<ol> <li ng-repeat='p in famPeople'> {{p}}"
};
});
【问题讨论】:
标签: angularjs angularjs-directive