0
<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 i implement custom validation on it? m applying angularjs validation it works fine but I want custom valuation on this tag. I want user insert only alphabets in this textbox.

1 Answer 1

1

Use ngPattern directive and provide appropriate regular expression:

<input ng-pattern="/^[a-zA-Z]*$/" />
Sign up to request clarification or add additional context in comments.

1 Comment

@RanaAli That comment is not really helpful in determining the problem. What is your sample input that you expect to pass the validation but it does not or vice versa?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.