<body><script src="Https://code.angularjs.org/1.2.6/angular-animate.min.js"></script><script>varApp = Angular.module ('myApp', []); App.controller ('Myctrl', Function ($scope) {$scope. Name= [ { "name":"Code_bunny", "score":" -", "ID":"001" },{ "name":"White_bunny", "score":" -", "ID":"002" },{ "name":"Black_bunny", "score":" +", "ID":"003" } ]; $scope. ID=4; $scope. Insertdog=function () {if($scope. ID <Ten) {$scope. ID="xx"+$scope. ID; }Else if($scope .id< -) {$scope. ID="0"+$scope. ID; }Else{$scope. ID=$scope. ID; $scope. Name.splice ($scope. Name.length,0,{"name":"Code_dog","score":"101","ID": $scope. ID}); $scope. ID++; }; $scope. Dellast=function () {$scope. Name.splice (-1,1); }});</script><div ng-controller="Myctrl"><ul> <li ng-repeat="list in name"> <spanclass='Index'>{{$index +1}}</span> <spanclass="name">{{list.name}}</span> <spanclass="score">{{list.score}}</span> <spanclass="ID">{{list.id}}</span> </li> </ul><button ng-click="Insertdog ()"> Add </button><button ng-click="dellast ()"> Delete </button></div></body>The $index is the index value of the iteration, which indicates the current iteration to the first number. Starting from 0
Angular adding a Delete to the DOM