Reputation: 1770
i am trying to add a count to an ng-repeat expression, it should do the following:
<div ng-repeat="item in items">
<div ng-click="clickme(item)">click me!</div>
<div>{{item.clicked}}</div>
</div>
now the following step is to count the number of times one has clicked the "click me" for that specific item, one could click multiple times of course so the number (expression) needs to update in the ng-repeat
$scope.items = [{
"id": 1,
"clicked": 10
}, {
"id": 2,
"value": 20
}]
$scope.clickme = function(item){
console.log(item.id)
console.log(item.clicked)
var total = item.clicked + 1;
$scope.this.clicked = total; //??
}
so the question would be, how would i be able to increment just this expression with 1 when clicked and the other expressions in the ng-repeat stay the same
Upvotes: 1
Views: 21