ng-if is used for removing or for recreating an html element to dom. When expression assigned to ng-if is evaluated to true element is recreated, if expression is evaluated to false html element is removed from dom.

ng-if example:

<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>
</head>
<body>
<b>check the checkbox to see ng-if example .</b>
<div ng-app="" ng-init="isChecked=true">
Check or Uncheck me to see changes:<input type="checkbox" ng-model="isChecked"></input>
<br>
<input type="text" ng-if="isChecked" value="i am removed from dom if you check the check box"  
style="width:400px;border-color:red;color:blue"></input>
</div>
</body>
</html>
Sample Explained: In the above given sample when user check the checkBox, true is assigned to isChecked model variable else false is assigned. By default check box is checked Since isChecked variable value is initialized with true. When check box is checked text box is removed from dom and hence will not be visble to user. note: all html elements are converted into dom tree when html code is given to browser.