2
根据文档和其他SO问题,我应该能够输出一组键/值对与ng-repeat
AngularJS NG重复不工作的对象
$scope.getFilters = function(){
return {
film : true,
game : true,
music : true,
sport : true,
tv : true
}
}
$scope.filters = $scope.getFilters();
然后,这是我的HTML
{{filters}}
<div
ng-repeat="(name,set) in filters"
>
{{name}} : {{set}}
</div>
但是,这是我从获得:
{"film":true,"game":true,"music":true,"sport":true,"tv":true}
<!-- ngRepeat: (name,set) in filters -->
我试过JS小提琴,它禾RKS。这只是我的代码的一小部分,页面上有更多内容,但我无法在此粘贴。
UPDATE:只注意到这个错误:
Error: Duplicates in a repeater are not allowed. Repeater: (name,set) in filters key: boolean:true
好的 - 现在很明显,发现了其他地方的错误,这要归功于我添加的console.log。 http://stackoverflow.com/questions/16296670/angular-ng-repeat-error-duplicates-in-a-repeater-are-not-allowed –