【发布时间】:2017-10-26 20:53:42
【问题描述】:
我在渲染从 firebase 检索到的对象的值时遇到问题。我必须按如下方式完成这项工作:
仅供参考,数据来自这里,它做得很好:
数据是这样的结构:
userProfile:FirebaseObjectObservable<any>;
db.object('/users/'+auth.uid,{ preserveSnapshot: true })
.subscribe(snapshot => {
this.userProfile = snapshot;
});
在我的 HTML 中,我可以使用以下内容渲染出对象:
{{ userService.userProfile | json }}
OUTPUT rendered is: { "email": "sdfsdf@fffdsfsdf22.com", "provider": "password" } // THIS is GREAT!!!! now I just need to extract the email... and will need more values later
现在我只需要呈现电子邮件值......但我所做的一切都不起作用,我尝试过的事情没有呈现结果
{{ userService.userProfile.email }} //nothing
{{ userService.userProfile.email | json }} //nothing
{{ userService.userProfile.email | json | async }} //nothing
{{ userService.userProfile.email | async }} //nothing
{{ ( userService.userProfile.email ) | async }} //nothing
{{ ( userService.userProfile.email ) | json }} //nothing
{{ ( userService.userProfile?.email ) | json }} //nothing
{{ ( userService.userProfile?.email ) | async }} //nothing
{{ ( userService.userProfile)?.email | async }} //nothing
{{ ( userService.userProfile)?.email | json }} //nothing
{{ ( userService.userProfile)?.email }} //nothing
{{ ( userService)?.userProfile.email }} //nothing
{{ userService?.userProfile?.email }} //nothing
{{ userService?.userProfile?.email | async }} //nothing
{{ userService?.userProfile?.email | json }} //nothing
我确定我做错了什么,但无法弄清楚为什么它在高级别的工作,但没有输出特定的属性。
【问题讨论】:
-
userService是什么? -
userService 是它被注入的父组件。
标签: angular firebase firebase-realtime-database angularfire2