大家好,我有一小段代码没有编译。我在我的代码中使用 angular 5 、 rxjs 和 typescript 。
错误是无法分配 this.account = value 。它说 value 是 Observable 并且不能分配给 this.account 这是一个 Account 对象。
this.authenticationService.currentUser$.pipe(
map( user => user.account.id),
map( id => this.accountService.get(id) )
).subscribe(
value => { this.account = value }
);
知道如何重写代码片段以使其正常工作吗?太感谢了