Please note, this is a STATIC archive of website www.w3schools.com from 05 May 2020, cach3.com does not collect or store any user information, there is no "phishing" involved.
THE WORLD'S LARGEST WEB DEVELOPER SITE

AngularJS ng-show Directive


Example

Show a section when a checkbox is checked:

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

Definition and Usage

The ng-show directive shows the specified HTML element if the expression evaluates to true, otherwise the HTML element is hidden.


Syntax

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

Supported by all HTML elements.


Parameter Values

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