0
まずはごめんなさい! 私はそれを説明しようとします、それは非常にノブの質問ですが、それは私が角とhtmlで今いるものです。 イメージソース(http://picture.....png)に含まれる文字列であるfirebaseデータベースからオブジェクトを取り出しました。 html imgのsrcにするにはどうしたらいいですか? これは私のコードです:HTMLで角を付けたFirebaseから取得したimgを表示
HTML:
getUserPicture(company: string, userid: string) {
return this.getUid().then(uid => {
return this.db.object(`companies/${company}/users/${uid}/sPicture`);
});
}
ユーザーページ:角度コードで
<span *ngIf="chat.from !== uid">
<ol class="chat">
<li class="self">
<div class="avatar"><img src="picture" **<--- here goes the retrieved picture** draggable="false"/></div>
<div class="msg">
<p>{{ chat.message }}</p>
<time>{{ chat.time }}</time>
</div>
</li>
</ol>
</span>
</span>
ユーザープロバイダ
openChat(key) {
this.userProvider.getCompany().then(company => {
this.userProvider.getUserPicture(company, key).then(picture => {
let param = {company: company,uid: this.uid, interlocutor: key, picture: picture};
this.nav.push(ChatViewPage,param);
})
});
I印刷するそれは示しています:
this.picture = params.data.picture;
console.log: picture = [object Object]
だから私はかなり確認されています。それを文字列に変換する必要がありますか?どのようにしてsrc imgをその画像に設定するのですか?
私があなたを理解できることを願っています。 ありがとう!