【发布时间】:2016-09-05 15:33:27
【问题描述】:
我需要使用没有 ngFor 的异步管道。我需要检查用 observable 异步加载的对象的属性。
这是我想要的,但不起作用:
<ion-item *ngIf="user$.anonymouse | async">
<ion-label>Login</ion-label>
</ion-item>
//编辑:当我使用上面的代码时出现此错误
异常:[!user$.anonymouse | 中管道“AsyncPipe”的参数“true”无效SettingsPage@27:22 中的异步]
有什么办法可以解决这个问题吗?
我知道我可以在 Ctrl 中订阅这个 observable 并将值存储到普通变量中,但我不想这样做,因为性能等原因。
【问题讨论】:
-
那么,有什么问题?
-
angular.io/docs/ts/latest/api/common/AsyncPipe-class.html asyncPipe 不需要 ngFor。
-
如果我使用上面的代码会出错,我在问题中添加了错误。
-
@DavidL 截至目前(2.0+)它可以工作。 :)
标签: angular ionic-framework rxjs