In this example we can show div element whose Id is "my-div" based on value of showDiv variable with ng-model directive which will set the value of checkbox to showDiv variable.If ng-if evaluates showDiv variable value is true then div will show otherwise it will hide.

<!DOCTYPE html> <html xmlns=""> <head> <title>Welcome to LearnKode - A code learning platform</title> <script src=""></script> </head> <body ng-app> <div> <input type="checkbox" ng-model="showDiv" /> <label for="showDiv">Toggle Div</label> <div ng-if="showDiv"> Learn It <b>ng-if Example</b> </div> </div> </body> </html>