Labels

Wednesday, November 25, 2015

Angular Patterns

ng-Pattern : We can use angular patterns to validate input type. adds the pattern validator to ngModel. It is most often used for text-based input controls, but can also be applied to custom text-based controlsEdit in plunkrSteps involved

Specify input type

Specify the angular pattern in regular expression

<inputtype="number"name="price_field1"ng-model="price1"ng-pattern="/^(0|[1-9][0-9]*)$/"/><spanng-show="frm1.price_field1.$error.pattern">
Not a valid number !
</span>