![](/img/trans.png)
[英]How to prevent the delay in evaluating ngIf condition in angular 6? Default image is displayed before evaluating the value. How to prevent this?
[英]Evaluating *ngIf with observable value inside condition
我很难理解为什么在下面提到的方式中使用*ngIf
会抛出Template Parse Error: Parser Error: Missing expected ) at ...
<ng-container *ngIf="true && (temp$ | async as temp)">
{{temp}}
</ng-container>
重构上述代码的工作原理
<ng-container *ngIf="true">
<ng-container *ngIf="temp$ | async as temp">
{{temp}}
<ng-container>
</ng-container>
我可以在不使用嵌套容器的情况下做到这一点吗?
您可能正在寻找的是以下内容(您只需要移动右括号):
<ng-container *ngIf="true && (temp$ | async) as temp">
{{temp}}
</ng-container>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.