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

How to optionally allow negative numbers? #114

Closed OlgerCA closed 8 years ago

OlgerCA commented 8 years ago

Hi! Is there any way to optionally allow negative numbers? For example allow both 99 and -99 as valid inputs?

Thanks

mr-raptor commented 8 years ago

Hi, you can try something like this: <input type="text" ng-model="maskModel" mask="*99?" restrict="reject" validate="false" data-ng-pattern="/^(-(\d){1,2}|(\d){1,3})$/" />

OlgerCA commented 8 years ago

Thank you so much! I will give it a try. :)