AngularJS Text – Allow Numeric Only

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.


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.


Thiruppathi Rengasamy
I'm a Dotnet Developer & Blogger. And also I'm working as a senior software engineer. I would like to spend my precious time writing articles, research on .Net technologies, and learning new technologies.