In this example, By default value of isHide variable is true as vm.isHide = true, If we click on the text "Click Here" second div text will display or vice versa on the basis of value of isHide variable. Here is the code on div ng-if="vm.isHide" and ng-click like ng-click="vm.isHide=!vm.isHide".

<!DOCTYPE html> <html xmlns=""> <head> <title>Welcome to LearnKode - A code learning platform</title> <script src=""></script> <style type="text/css"> .cursor{ cursor:pointer; } </style> </head> <body ng-app="initExample"> <div ng-controller="ExampleController as vm"> <div class="row"> <div class="col-md-6" ng-init="isHide=true"> <div ng-if="vm.isHide" class="cursor" ng-click="vm.isHide=!vm.isHide"><h3>Click here...</h3></div> <div ng-if="!vm.isHide" class="cursor" ng-click="vm.isHide=!vm.isHide"><h3>Hi.. This is an example of ng-if. </h3></div> </div> </div> </div> <script> var app = angular.module("initExample", []); app.controller('ExampleController', ['$scope', function ($scope) { var vm = this; vm.isHide = true; }]); </script> </body> </html>