3
<div *ngIf="!!(result$ | async)">
{{!!(result$ | async)}}
</div>
我希望它是空白的,然后显示true
。令人惊讶的是,它显示false
然后true
。 {{}}
和*ngIf
有没有不同的评估机制? result$
类型为Observable<{ products: any[] }>
。为什么AsyncPipe在{{}}评估不同,* ngIf
constructor() {
this.result$ = Observable.of("Dummy!").delay(3000);
}
你可以发布myService.getResult函数的实现吗? –
@HarryNinh这里是他执行 – rgripper
如果我不得不猜测,我会说结构指令在ViewInit和interInjection在ContentInit – cvsguimaraes