leftstick / angular-number-picker

A directive used for picking number by using up/down button, instead of typing
MIT License
23 stars 11 forks source link

angular-number-picker in ng-repeat #16

Closed Brhernann closed 7 years ago

Brhernann commented 7 years ago

Hi, i have a simple question how can i use it in ng-repeat?

I have a dynamic array with different elements and i can´t Assign a different value but to be independent.

leftstick commented 7 years ago

Try not use value directly linked at $scope, but with the repeat data instead, as below:

demo.controller('DemoController', ['$scope', function($scope) {

        $scope.items = [{
          label: 'shaver',
          num: 0
        },{
          label: 'oven',
          num: 0
        }];
}]);
<div ng-repeat="item in items" class="item">
      <label for="">{{ item.label  }}</label>: <h-number value="item.num" min="0" max="10" step="1"></h-number>
</div>

Here is the plunker