How to remove object from array within ng-repeat with AngularJS?
问题 I am having an array with objects like [{...}, {...}] which I am outputting with ng-repeat. Then I have a delete button with a function to delete it. Is there a simple way to delete it in AngularJS, perhaps with $index? Or I need to specify an ID on every object as an property? 回答1: If you don't apply a filter to reorder or filter your array, you can do this: <div ng-repeat="item in items" ng-click="delete($index)">{{item}}</div> And the delete function: $scope.items = [...]; $scope.delete =