我需要在没有ngFor的情况下使用异步管道(async pipe)。我需要检查一个通过observable异步加载的对象的属性。
这是我想要的,但它不起作用:
<ion-item *ngIf="user$.anonymouse | async">
<ion-label>Login</ion-label>
</ion-item>
//编辑:我在使用上述代码时遇到了这个错误
异常:在[!User$.anonymouse | async in SettingsPage@27:22]中,管道'AsyncPipe'的参数“true”无效
有什么办法可以解决这个问题吗?
我知道可以在Ctrl中订阅此observable并将值存储到正常变量中,但我不想这样做,因为会影响性能等原因。