AngularJS nghide Directive (original) (raw)
AngularJS ng-hide Directive
Last Updated : 03 Aug, 2022
The ng-hide Directive in AngluarJS is used to show or hide the specified HTML element. If the expression given in the ng-hide attribute is true then the HTML elements hide. In AngularJS there is a predefined class named ng-hide which is used to set the display to none.
Syntax:
Contents...Parameter:
- expression: It specifies the element will be hidden if the expression returns true.
Example 1: This example uses the ng-hide Directive to display whether the entered number is a multiple of 5 or not.
HTML `
ng-hide DirectiveGeeksforGeeks
ng-hide Directive
Enter a number:The number is multiple of 5
The number is not a multiple of 5
`
Output:
Example 2: This example uses the ng-hide Directive to hide content.
HTML `
ng-hide DirectiveGeeksforGeeks
ng-hide Directive
Hide ParagraphHide this paragraph using ng-hide
</div>
<script>
var myapp = angular.module("app", []);
myapp.controller("geek", function($scope) {
$scope.hide = false;
});
</script>
`
Output: