Angularjs Examples

AJS Examples

AngularJS ng-If Directive

The AngularJS ng-if directive is used to completely removes and recreates the element in the DOM if condition meet.


<div ng-if="checked">

AngularJS ng-If Directive Example

<html ng-app>
<title>My first AngularJS code</title>
<Script SRC="">
Click Me <input type="checkbox" ng-model="checked" ng-init="checked=true" /><br/>
<div ng-if="checked">
  This will remove when button clicks!
See Live Example