Skip to content

Instantly share code, notes, and snippets.

@javebratt
Created April 4, 2017 15:43
Show Gist options
  • Save javebratt/0d0986a07566766c851cff7fe3a9a639 to your computer and use it in GitHub Desktop.
Save javebratt/0d0986a07566766c851cff7fe3a9a639 to your computer and use it in GitHub Desktop.
// The pictures I'm guessing are in Firebase Storage, but they need to be linked (through the download URL) to the database,
// so something like:
userProfile: {
user1: {
name: "Jorge",
profilePicture: "https://link_to_picture"
}
}
// So to cath them you need to make a Firebase call:
firebase.database().ref("userProfile").on('value', profileListSnapShot => {
// Somewhere in your page you should have a profile list variable declared, we're going to use it here:
let tempList = [];
profileSnapShot.forEach( snap => {
tempList.push(snap.val());
return false;
});
this.profileList = tempList;
});
// Then in the HTML you can call the list:
<ion-list>
<ion-item *ngFor="let profile of profileList">
<h2>{{ profile?.name}}</h2>
<img [src]="{{ profile?.profilePicture }}" />
</ion-item>
</ion-list>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment