The AngularJS ng-if
directive is used to completely removes and recreates the element in the DOM if condition meet.
Syntax
<div ng-if="checked"> </div>
<html ng-app> <head> <title>My first AngularJS code</title> <Script SRC="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.13/angular.js"> </Script> </head> <body> Click Me <input type="checkbox" ng-model="checked" ng-init="checked=true" /><br/> <div ng-if="checked"> This will remove when button clicks! </div> </body> </html>See Live Example