angularjs ng-if directive
Uncheck,And remove content:
<! 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=""> Keep html:<input type="checkbox" ng-model="myvar" ng-init="myvar=true"> <div ng-if="myvar"> <h1>welcome</h1> <p>welcome to my home.</p> <hr> </div> <p>The div element will be removed when the checkbox is unchecked. </p> <p>When the checkbox is rechecked,The div element is redisplayed. </p> </body> </html>
Definition and usage
The ng-if directive is used to remove html elements when the expression is false.
If the if statement evaluates to true, elements are added and removed,And displayed.
The ng-if directive is different from ng-hide, ng-hide hides elements,Ng-if removes elements from the dom.
All html elements support this directive.
|expression||If the expression returns false, the entire element is removed,If true, elements are added.|
- python - you may need to restart the kernel to use updated packages error
- php - coincheck api authentication doesn't work
- php - i would like to introduce the coincheck api so that i can make payments with bitcoin on my ec site
- [php] i want to get account information using coincheck api
- the emulator process for avd pixel_2_api_29 was killed occurred when the android studio emulator was started, so i would like to
- python 3x - typeerror: 'method' object is not subscriptable
- i want to call a child component method from a parent in vuejs
- xcode - pod install [!] no `podfile 'found in the project directory
- sh - 'apt-get' is not recognized as an internal or external command, operable program or batch file