AngularJS ng-hide directive
AngularJS instance
Hide a part when check box is selected:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="/libs//1.4.6/"></script> </head> <body ng-app=""> hide HTML: <input type="checkbox" ng-model="myVar"> <div ng-hide="myVar"> <h1>Welcome</h1> <p>Welcome to my home.</p> </div> </body> </html>
Definition and usage
ng-hideDirectives hide HTML elements when the expression is true.
ng-hideis a predefined class of AngularJS, setting the display of the element to none.
grammar
<element ng-hide="expression"></element>
Use as CSS class:
<element class="ng-hide"></element>
All HTML elements support this directive.
Parameter value
value | describe |
---|---|
expression | The expression hides the element if it returns true. |
The above is the basic knowledge of AngularJS ng-hide directive, and will be added later.