English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
!DOCTYPE html <html> <head> <meta charset="utf-8"> <script src="https://cdn.staticfile.org/angular.js/1.4.6/angular.min.js">/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>/p> </div> </body> </html>Test to see ‹/›
ng-hide directive hides HTML elements when the expression is true.
ng-hide is an AngularJS predefined class that sets the element's display for none.
<element ng-hide="expression"></element>
Used as a CSS class:
All HTML elements support this directive.
Value | Description |
---|---|
expression | Hide the element if the expression returns true. |