html - angularjs custom validation on input type="text" -


<section class="col col-6">    <label class="input">       <i class="icon-append fa fa-building"></i>       <input type="text" ng-model="customer.name" name="customername" placeholder="customer name" required>       <span style="color:red" ng-show="myform.customername.$dirty && myform.customername.$invalid">          <span ng-show="myform.customername.$error.required">name required</span>       </span>    </label> </section> 

how can implement custom validation on it? m applying angularjs validation works fine want custom valuation on tag. want user insert alphabets in textbox.

use ngpattern directive , provide appropriate regular expression:

<input ng-pattern="/^[a-za-z]*$/" /> 

Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -