AngularJS HTML DOM

Source: Internet
Author: User

AngularJS HTML DOM

AngularJS provides instructions for binding application data to the attributes of an HTML DOM element.

ng-disabled Directive

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

Example

<div ng-app= "" ng-init= "Myswitch=true" >
<p>
<button ng-disabled= "Myswitch" > Point I!</button>
</p>
<p>
<input type= "checkbox" ng-model= "myswitch" > button
</p>
<p>
{{Myswitch}}
</p>
</div>

Example Explanation:

The ng-disabled directive binds the application data "Myswitch" to the disabled property of the HTML .

the ng-model directive binds "Myswitch" to the contents of the HTML input checkbox Element (value ).

If myswitch is true, the button will not be available :

<p>
<button disabled> point me! </button>
</p>

If myswitch is false, the button is available :

<p>
<button> i!</button>.
</p>

ng-show Directive

The ng-show directive hides or displays an HTML element.

Example

<div ng-app= "" >
<p ng-show= "True" > I was visible. </p>
<p ng-show= "false" > I am not visible. </p>
</div>

The ng-show directive displays (hides)HTML elements based on value values .

You can use an expression to evaluate a Boolean value ( true or false):

Example

<div ng-app= "" >
<p ng-show= "Hour >" > I was visible. </p>
</div>

AngularJS HTML DOM

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.