ngPattern is one of the useful things for validation in AnjularJs. AnjularJs ngPattern adds pattern to ngmodel. It is mainly used in text-based form controls.
The following are some of the sample patterns:
<input type="text" ng-model="mail" name="mail" ng-pattern="/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i" >
Phone
<input type="text" ng-model="mobile" name="mobile" ng-pattern="/^(\+\91{1,2}[- ])\d{10}$/" />
Landline Phone
<input type="text" ng-model="landLine" name="landLine" ng-pattern="/^[0-9]\d{2,5}-\d{6,8}$/" />
Password
<input name="password" ng-pattern="/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/" type="password">
Number
<input type="text" ng-model="number" name="number" ng-pattern="/^[0-9]{1,6}$/" >
Alphabets
<input type="text" ng-model="number" name="number" ng-pattern="/^[a-zA-Z ]{1,25}$/" />
Card Number
<input type="text" ng-model="cardNumber" name="cardNumber" ng-pattern="/^[0-9]{16,16}$/" />
CVV Number
<input type="text" ng-model="cvv" name="cvv" ng-pattern="/^[0-9]{3,3}$/" />