AngularJS Basic ng show Simple Example
- 2021-07-07 06:29:49
- OfStack
AngularJS ng-show Directive
AngularJS instance
When the check box is selected, some contents are displayed:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://apps.bdimg.com/libs/angular.js/1.4.6/angular.min.js"></script>
</head>
<body ng-app="">
Display HTML: <input type="checkbox" ng-model="myVar">
<div ng-show="myVar">
<h1>Welcome</h1>
<p>Welcome to my home.</p>
</div>
</body>
</html>
Definition and usage
The ng-show directive displays the specified HTML element when the expression is true, otherwise hides the specified HTML element.
Grammar
<
element ng-show="expression"
>
<
/element
>
All HTML elements support this instruction.
Parameter value
值 | 描述 |
---|---|
expression | 如果表达式为 true 则显示指定的 HTML 元素。 |
The above is the collation of the basic data of AngularJS ng-show instruction, and the relevant data will be supplemented in the future.