angular - 如何将 firebase 的 uid 读取为正常的显示名称?
问题描述
我有这个注册方法:
onSubmit(){
this.authService.doRegister(this.email.value, this.password.value)
.then(res => {
console.log(res);
this.errorMessage = "";
this.successMessage = "Your account has been created";
}, err => {
console.log(err);
this.errorMessage = err.message;
this.successMessage = "";
})
}
服务:
doRegister(email, password) {
return new Promise<any>((resolve, reject) => {
firebase.auth().createUserWithEmailAndPassword(email, password)
.then(res => {
resolve(res);
}, err => reject(err))
})
}
然后是一个显示列表,我希望将帖子与人的实际姓名相关联,而不是这个 userId
<div class="row">
<div class="col-md-6">
<mat-list role="list" *ngFor="let post of posts">
<mat-list-item role="listitem">Title: {{post.title}}</mat-list-item>
<mat-list-item role="listitem">Body: {{post.body}}
</mat-list-item>
<mat-list-item role="listitem">By: {{post.userId}}</mat-list-item>
</mat-list>
</div>
</div>
我怎样才能做到这一点?我读过很多死胡同的帖子说这是不可能的。是吗?
解决方案
推荐阅读
- cucumber-java - 如何通过 feature 文件在 serenity 报告中显示 rest API 的 HTTP 响应状态
- c++ - 传递数组时出现分段错误
- cefsharp - 绑定对象不释放
- laravel - 突然间,我在测试中得到了 UnexpectedJavascriptException
- python - 如何将坐标从图像映射到 2D 表面
- angularjs - 如何使用 $resource POST 操作设置自定义标题?
- javascript - 看来我的 ajax 有效,但没有发布任何内容
- android - 如何在 Firebase 数据库子参考中使用字符串?
- c# - 需要 WCF 安全说明
- javascript - 如何在 JS 淡入淡出幻灯片中插入 CSS 转换旋转动画?