In this example, we have div with ng-if="!vm.IsShow" and By default value of vm.IsShow is false, So on the basis of vm.IsShow value div element will show or hide. On button click, We are using ng-click like ng-click="vm.IsShow=!vm.IsShow" so that will change the value of vm.IsShow variable and make div visible or hidden.

<!DOCTYPE html> <html xmlns=""> <head> <title>Welcome to LearnKode - A code learning platform</title> <script src=""></script> <link rel="stylesheet" href=""> </head> <body ng-app="initExample"> <div ng-controller="ExampleController as vm"> <div ng-if="!vm.IsShow"> <input type="button" class="btn btn-primary" ng-click="vm.IsShow=!vm.IsShow" value="Login"> <p>Please Login</p> </div> <div ng-if="vm.IsShow"> <button class="btn btn-primary" ng-click="vm.IsShow=!vm.IsShow">Logout</button> <p>Welcome !</p> </div> </div> <script> var app = angular.module("initExample", []); app.controller('ExampleController', ['$scope', function ($scope) { var vm = this; }]); </script> </body> </html>