AngularJS ng-show directive
AngularJS instance
Some contents are displayed when the check box is selected:
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="/libs//1.4.6/"></script> </head> <body ng-app=""> show HTML: <input type="checkbox" ng-model="myVar"> <div ng-show="myVar"> <h1>Welcome</h1> <p>Welcome to my home.</p> </div> </body> </html>
Definition and usage
ng-show Directive displays the specified HTML element when the expression is true, otherwise hides the specified HTML element.
grammar
<element ng-show="expression"></element>
All HTML elements support this directive.
Parameter value
value | describe |
---|---|
expression | If the expression is true, the specified HTML element is displayed. |
The above is a compilation of the basic information of the AngularJS ng-show instruction, and the relevant information will be added in the future.