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

Adding an ng-change #2

Closed acedesigns closed 9 years ago

acedesigns commented 9 years ago

Hey There Howard. This more of a feature than a issue.

I was trying to do the following: pn my Controller

demo.controller('Demo', ['$scope', function($scope) {
   $scope.input = { num: 0 };
  $scope.NumberChanged = function () {
    alert( $scope.input.num );
  };
$scope.getNumber = function() {
     alert('The number is: [' + $scope.input.num + ']');
   };
}]);

My Html

<h-number 
    ng-change="NumberChanged()" 
    ng-model="number" 
    value="input.num" min="1" max="" step="1">
</h-number>
leftstick commented 9 years ago

Since ng-change requires the ng-model which i haven't used in my implementation. So i'd like to give a new attribute called change to fulfill your requirement.

It's done in version 1.2.0, give a try, and welcome your comments