AngularJS ng-show Directive

Definition and Usage

If the expression evaluates to true,ng-show The directive will display the specified HTML element, otherwise hide the HTML element.

Example

Display a section when the checkbox is selected:

Display HTML:<input type="checkbox" ng-model="myVar">
<div ng-show="myVar">
<h1>Welcome</h1>
<p>Welcome to my home.</p>
</div>

Try It Yourself

Syntax

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

All HTML elements support it.

Parameter

Parameter Description
expression Element is displayed only when the expression returns true.