Angularjs Quick Start Guide 10:dom node

Source: Internet
Author: User

ANGULARJS binds application data to the attributes of an HTML DOM element through directives.

ng-disabled directive

  The ng-disabled directive binds ANGULARJS application data to the disabled attribute of the HTML element.

<DivNg-app=""><P><Buttonng-disabled= "Myswitch">Click me!</Button></P><P><inputtype= "checkbox"Ng-model= "Myswitch">Button</P></Div>

Run

Code Explanation:

  The ng-disabled directive binds the application data myswitch to the disabled property of the HTML button.

  The ng-model directive binds the value values of the HTML checkbox element to the myswitch object.

If the value of myswitch is true, the button will be disabled out:

< P > <  disabled>Click me! </ Button > </ P >

If the value of myswitch is false, the button is not disabled out:

< P > < Button > Click me! </ Button > </ P >
Ng-show directive

  The ng-show directive is used to show or hide an HTML element.

<DivNg-app=""><PNg-show= "true">I am visible.</P><PNg-show= "false">I am not visible.</P></Div>

Run

The ng-show instruction displays (or hides) an HTML element through value values.

You can use any expression that can return True or FALSE, for example:

<ng-app= ""><ng-show= "Hour > ">I am visible. </ P > </ Div >

Run

In the following chapters there will be more examples of hiding HTML elements through the Click event of a button.
Ng-hide directive

We can also hide or display an HTML element by Ng-hide instructions.

<DivNg-app=""><PNg-hide= "true">I am not visible.</P><PNg-hide= "false">I am visible.</P></Div>

Run

Previous chapter-Angularjs Quick Start Guide 09:sql Next chapter-Angularjs Quick Start Guide 11: Events

Angularjs Quick Start Guide 10:dom node

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.