AngularJS ng-showDirective

AngularJS 参考手册AngularJS Reference Manual


AngularJS Example

Show partial content when 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 »

Definition and Usage

ng-showThe directive displays the specified HTML element when the expression is true, otherwise hides the specified HTML element.


Syntax

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

All HTML elements support this directive.


Parameter Value

Value Description
expression If the expression is true, the specified HTML element is displayed.

AngularJS 参考手册AngularJS Reference Manual

Other Extensions