Easy to get started with forms in Angularjs _angularjs

Source: Internet
Author: User

Angularjs form

The Angularjs form is a collection of input controls.

HTML Control

The following HTML INPUT element is called an HTML control:

Input Element
Select Element
button Element
textarea Element

HTML form

HTML forms typically exist at the same time as HTML controls.

ANGULARJS form Instances

The Name:

Last Name:


RESET

form = {"FirstName": "John", "LastName": "Doe"}

Master = {"FirstName": "John", "LastName": "Doe"}

Application code:

 <! DOCTYPE html>  
 

Run Result:

The Name:

Last Name:


RESET

form = {"FirstName": "John", "LastName": "Doe"}

Master = {"FirstName": "John", "LastName": "Doe"}

Note: The Novalidate property is added in HTML5. Default authentication using the browser is disabled.

Instance resolution

The ng-app directive defines the ANGULARJS application.

The ng-controller directive defines the application controller.

The ng-model directive binds two input elements to the model's user object.

The Formctrl function sets the initial value of the Master object and defines the reset () method.

The Reset () method sets the user object equal to the Master object.

The ng-click instruction calls the Reset () method and is invoked when the button is clicked.

The Novalidate attribute is not required in the application, but you need to use it in the Angularjs form to override the standard HTML5 validation.

The above is the Angularjs form data collation, follow-up continue to supplement, hope to help programming students.

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.