How can you hide an HTML element just by a button click in Angular?
Ng-hide command is used to hide HTML elements if an expression is true.
Here's an example:
<div ng-app="DemoApp" ng-controller="DemoController">
<input type="button" value="Hide Angular" ng-click="ShowHide()"/>
<div ng-hide="IsVisible">Angular 8</div>
</div>
<script type="text/javascript">
var app = angular.module('DemoApp',[]);
app.controller('DemoController',function($scope){
$scope.IsVisible = false;
$scope.ShowHide = function(){
$scope.IsVisible = $scope.IsVisible = true;
}
});
</script>
Now in the above, when the Hide Angular button is not clicked(the expression is set to false)
BY Best Interview Question ON 31 Mar 2020