Curriculum
Course: AngularJS
Login

Curriculum

AngularJS

AngularJS Tutorial

0/65
Text lesson

The ng-show Directive

The ng-show directive controls the visibility of an HTML element by showing or hiding it.

AngularJS Example

<div ng-app=””>

<p ng-show=”true”>I am visible.</p>

<p ng-show=”false”>I am not visible.</p>

</div>

The ng-show directive controls the visibility of an HTML element based on its value, allowing any expression that evaluates to true or false.

AngularJS Example

<div ng-app=”” ng-init=”hour=13″>

<p ng-show=”hour > 12″>I am visible.</p>

</div>

The ng-hide Directive

The ng-hide directive hides (or shows) an HTML element.

AngularJS Example

<div ng-app=””>

<p ng-hide=”true”>I am not visible.</p>

<p ng-hide=”false”>I am visible.</p>

</div>