Angular2 渲染多级 Firebase 对象
Angular2 render multilevel Firebase Object
我无法呈现从 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
我确定我做错了什么,但无法弄清楚为什么它在高级别工作,但没有输出特定的 属性。
几天前我遇到了类似的问题。请尝试:
snapshot.val()
我无法呈现从 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
我确定我做错了什么,但无法弄清楚为什么它在高级别工作,但没有输出特定的 属性。
几天前我遇到了类似的问题。请尝试:
snapshot.val()