我用的是角11。不知怎么的,我不能让这个div消失:我的简单HTML:
<div ng-hide="true">Test</div>结果->文本测试仍然出现在我的页面上。
发布于 2021-07-19 06:15:46
在Angular2+中,没有带有ng-格式的指令。此格式仅适用于angular.js。但是您知道,在Angular2+中有几乎相同的指令。
对于您的问题,有一些方法可以实现ng-hide的相同行为
第一个是:[hidden]=true
<div [hidden]="true">…content..</div>第二个是:*ngIf
<div *ngIf=”bolShow”>…content…</div>第三种是像这样的样式绑定:[style.visibility]
<div [style.visibility]="bolShow ? 'visible' : 'hidden'">…content…</div>发布于 2021-07-19 05:57:33
ng-hide和ng-show不存在于角2+中,而仅存在于AngularJS中。我在用
<div [hidden]="true">Text</div>现在。
https://www.telerik.com/blogs/what-is-the-equivalent-of-ng-show-and-ng-hide-in-angular
https://stackoverflow.com/questions/68435688
复制相似问题