0
有没有任何“角度的方法”来避免在ng-repeat
中显示重复?ng-repeat没有重复
如果我们在数组中添加重复项,它会弹出[ngRepeat:dupes]
,这可以用ng-repeat="item in items track by $index"
来解决。好。
但是,如果我们不想显示重复项呢?我曾想过在创建这样的阵列时要进行过滤:
if(!$scope.items.indexOf($scope.item) == -1) {
$scope.items.push($scope.item);
}
但是还有没有其他的棱角方式?