I have a list of items coming from database and the items are selected by the user and as per their selection they can add the quantity of selected item by just incrementing or decrementing the counter onClick of the signs(+,-).And i have done it this way
<table class="table table-hover"><tr ng-repeat="samData in sampleData">
<td >{{samData}}</td>
<td> <a ng-click="increment()">+ {{count}}</a>
<a ng-click="decrement()" >-</a>
</td><td>
controller js:
$scope.decrement = function() {
$scope.count = $scope.count - 1;
if ($scope.count < 0){
$scope.count = 0;
}
};
$scope.increment = function() {
$scope.count = $scope.count + 1;
};
but the problem is as i click on any particular "td" all the counters gets affected which i don't want plz tel me how to associate the counter to each record and accordingly make the changes to the only clicked 'td'