Skip to main content

Posts

Showing posts with the label ng-pattern validation in angularjs

ng-pattern validation in angularjs

The  ng-pattern validation are use to validate the input fields with help of  regular expressions. The  regular expression can be number, email etc. If field is validated then return true otherwise return false. In the below example, I am using the. input type=" number " because I am going to validate the number. Required. ng-pattern attribute. number  regular expression [" /^\d{0,9}(\.\d{1,9})?$/" ] Go to live demo link http://plnkr.co/edit/eWmokT?p=preview The code sample as given below. < !doctype   html > < html > < head >      < meta   charset ="utf-8">      < title > ng pattern validation in angularjs </ title >      < script   src ="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.6/angular.js"></ script > </ head > < body >      < form   nam...