candreoliveira / ngMask

Best Angular mask alternative! No jQuery, pure JS. About ~6kb!
http://candreoliveira.github.io/#/ngMask
ISC License
419 stars 171 forks source link

Problem while updating model in backend code. #124

Open mikemicmike opened 7 years ago

mikemicmike commented 7 years ago

Hi, i'm having the same issue 95 described in this post with version 3.1.1 which was supposed to fix the issue.

Here is a small plunkr i made to replicate the issue.

Please help

boltex commented 7 years ago

Tested the plunker and I can confirm that when the model is changed it only works the first time!

I'm hoping this gets fixed soon!

hardik0207 commented 7 years ago

Hello,

NgMask is not working when change multiple times from backend (controller)

http://plnkr.co/edit/AToowLWirREHOagTH2dA?p=preview

I think, it is because of latest code changes. in latest version, you are de-register/register ngModel attribute watch.

// Register the watch to observe remote loading or promised data // Deregister calling returned function var watcher = $scope.$watch($attrs.ngModel, function (newValue, oldValue) { if (angular.isDefined(newValue)) { parseViewValue(newValue); watcher(); } });

If you remove watcher(); function, then it will work as expected

Thanks