Latest web development tutorials

AngularJS ng-if command

AngularJS Reference Manual AngularJS Reference Manual


AngularJS examples

Uncheck and remove content:

Reserved HTML: <input type = "checkbox " ng-model = "myVar" ng-init = "myVar = true">
<Div ng-if = "myVar ">
<H1> Welcome </ h1>
<P> Welcome to my home. </ P>
<Hr>
</ Div>

try it"

Definition and Usage

ng-if instructions for removing HTML elements expression when false.

If the statement is executed if the result is true, it will add remove elements and displays.

ng-if instruction is different from the ng-hide, ng-hide the hidden elements, ng-ifelement is removed from the DOM.


grammar

<Element ng-if = "expression "> </ element>

All HTML elements support the instruction.


Parameter Value

value description
expression If the expression returns false will remove the entire element, if true, would add an element.

AngularJS Reference Manual AngularJS Reference Manual