使用条件内的可观察值评估 *ngIf

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>