THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

AngularJS ng-hide Directive


Example

Hide a section when a checkbox is checked:

Hide HTML: <input type="checkbox" ng-model="myVar">
<div ng-hide="myVar">
<h1>Welcome</h1>
<p>Welcome to my home.</p>
</div>
Try it Yourself »

Definition and Usage

The ng-hide directive hides the HTML element if the expression evaluates to true.

ng-hide is also a predefined CSS class in AngularJS, and sets the element's display to none.


Syntax

<element ng-hide="expression"></element>

When used as a CSS class:

<element class="ng-hide"></element>

Supported by all HTML elements.


Parameter Values

Value Description
expression An expression that will hide the element if the expression returns true.