最佳答案
我试图从数组 $scope.items
中删除元素,以便在视图 ng-repeat="item in items"
中删除项
只是为了演示的目的,这里有一些代码:
for(i=0;i<$scope.items.length;i++){
if($scope.items[i].name == 'ted'){
$scope.items.shift();
}
}
I want to remove the 1st element from the view if there is the name ted right? It works fine, but the view reloads all the elements. Because all the array keys have shifted. This is creating unnecessary lag in the mobile app I am creating..
有人有办法解决这个问题吗?