AngularJS form verification example

Source: Internet
Author: User

Angular has form validation on its own, directly on the code:

1. When input is not started:

2. When the input does not conform to the rule:

3. When entering the compliance rule:

The summary method has several points:

1. Bind the instruction Ng-pattern in input, fill in the regular.

2. The Require attribute can be written directly in input, indicating that the item must be filled in.

3. Define a different display state span and control its display by Ng-show.

4. Two commonly used states, $invalid as invalid, $valid as valid.

5. You can use the NG-DISABLED directive to disable submitting forms when the form validation is not passed.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.