Open lucaszadok opened 9 years ago
I was just tracking down this error on my own implemetation.
The problem is in removeDivisors function in ngMask.js starting at line 395 https://github.com/candreoliveira/ngMask/blob/d33f52913deeccf3c039e7f16ada9482a9a7c442/dist/ngMask.js
Specifically, return value.replace(regex, ''); on line 412. Numbers don't have the replace function - only strings.
any solution?
So looking at this, I think we're looking at two different places with the same problem.
https://github.com/candreoliveira/ngMask/blob/master/dist/ngMask.js#L76
With this line, it is doing an automatic type cast to whatever the value is in the textbox. It would probably be better to do something like this:
if (typeof value == 'undefined') {
value = '';
} else {
//Cast to string in order to use String/RegExp functions
value = '' + value;
}
I'm not currently using this anymore or I would just drop it into my application. Try it and see if it works. If it does you or I can submit a pull request.
@gpit2286 - your fix worked for me, thank you. Is it possible for you to submit it as a PR? :)
I had this same issue. Switched the type from number to text worked for me.
When I use the mask it returns an error (below), I guess you are expecting a string.
TypeError: a.split is not a function