For example, I want to use the ng-repeat loop page to display the simulated data array object. I want to click the selected count + 1. how can I get the current element? if so! I want to get support and operate on support + 1. gid is the id of the file...
For example, I want to use the ng-repeat loop page to display the simulated data array object. I want to click the selected count + 1. how can I get this current element?
If so! I want to get support and operate on support + 1. gid is the id of the work, but each id can only be + 1, similar to the like function!
Reply content:
For example, I want to use the ng-repeat loop page to display the simulated data array object. I want to click the selected count + 1. how can I get this current element?
If so! I want to get support and operate on support + 1. gid is the id of the work, but each id can only be + 1, similar to the like function!
$indexYou can obtain the subscript of an element in the array, and then obtain the element according to the subscript.
{{ item.count }}
Add the ng-click method to the element li in ng-repeat, and obtain the current element through event.tar get.
- {{item.name}} {{itemNumber}}
《script》 $scope.itemNumber=0; $scope.addItem=function($index){ angular.forEach($scope.items,function(item,index){ if($index==index){ $scope.itemNumber++; } }) }《script》
My personal implementation method is probably like this