Numbers Only Directive In Angular JS

This is my custom version of an Angular JS Directive to ensure input values are digits only.

You can then use the directive in the input field like this:

Using ng-pattern regex is good only for validation but does not hinder the user from inputting non-numeric characters so having a directive like this makes it even better to be sure that inputs are numeric only.

Related Posts Plugin for WordPress, Blogger...

Leave a Reply

Your email address will not be published. Required fields are marked *