Can I use ng-show and ng-hide to display/hide a html template. If that template is different html file. I am trying to split my html file into two parts and show/hide it on a event.
It would be better is you use ng-if instead ng-show as it would save one html template request.
<div ng-if="some_condition">
<div ng-include="'template1_path.htm'"></div>
</div>
<div ng-if="!some_condition">
<div ng-include="'template2_path.html'"></div>
</div>
Yes you can use ngShow/ngHide
in conjunction with ngInclude
:
<div ng-show="some_condition">
<div ng-include="template1_path">
</div>
</div>
<div ng-show="!some_condition">
<div ng-include="template2_path">
</div>
</div>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.