Ng-Show-Ng-Hide-4

 
In this example we can change the text of button based on the ng-click event.By default text of button is "SHOW" because intially value of isShow variable is false.If we click on the button it will call the "changeValue(true)" function the value of isShow variable become true then text of button will set to "HIDE" and vice versa.
 
 
 
<!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Welcome to LearnKode - A code learning platform</title> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> </head> <body ng-app="app"> <div ng-controller="controllerName"> <button ng-hide="isShow" ng-click="changeValue(true)">SHOW</button> <button ng-show="isShow" ng-click="changeValue(false)">HIDE</button> </div> <script> var app = angular.module("app", []); app.controller('controllerName', ['$scope', function ($scope) { $scope.isShow = false; $scope.changeValue = function (isShow) { $scope.isShow = isShow; } }]); </script> </body> </html>
Output