I am using ionic 2 and Firebase 3, I want to get the data from firebase database and firebase storage, to make a list of news, each with thumbnail picture and news title and brief. I can achieve the news info from firebase database by news.ts as below :
this.newsData.getNewsList().on('value', snapshot => {
let rawList = [];
snapshot.forEach( snap => {
rawList.push({
id: snap.key,
brief: snap.val().brief,
title: snap.val().title,
details : snap.val().details,
date : snap.val().news_date,
thumbnail : snap.val().thumbnail
});
});
this.newsList = rawList;
});
And achieve it with news.html
<ion-card class="cardstyle" *ngFor="let news of newsList" >
<img [src]=“news.thumbnailurl”>
{{news?.date}}
{{news?.title}}
{{news?.brief}}
</ion-card-content>
However, the thumbnails are file names of firebase storage (image/filename.jpg),I need to convert them to downloadable URL first, it should perform getDownloadURL() first. May I know how I can achieve it in ionic2 ?
Many thanks for the help !