AngularJS Text – Allow Numeric Only2 min read

In this blog, I will demonstrate how to allow only numeric values in input textbox, using AngularJS. This technique is most useful for quantity and countable input text.

HTML Code

I have designed a simple input type “Text” in HTML.using AngularJS.

AngularJS Code

Create an Angular module and name it as  “csharpcor”.

Create Angular Controller for initiating the value.

Module and Controller name must assign to the HTML element.

Create Angular directives as given below.


 

Assgin a directive to the input text.


 

Leave a Reply

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