I want to display list of objects from the Firebase to the Ionic view using angularfire2 5.0.0-rc.2.
This is my list of objects from the Firebase
This is the method from the service, used to retrieve all the data related to Restaurants
getRestaurants() {
this.restaurants = this.af.list('/Restaurants')
return this.restaurants;
}
This the component where I accept data from the service
export class RestaurantsPage {
restaurants: Observable<any[]>;
constructor(public navCtrl: NavController, public af: AngularFireDatabase, public dataservice: handleDataService) {
this.dataservice.getUserEmail().subscribe(res => {
this.restaurants = this.dataservice.getRestaurants().valueChanges();
})
// this.items.subscribe(res => console.log(res[0].$key));
}
And this is the HTML page which I want to display my data
<ion-content class="card-background-page">
<ion-list>
<ion-item *ngFor="let restaurant of restaurants | async">
<ion-thumbnail item-start>
<img src="img/thumbnail-totoro.png">
</ion-thumbnail>
<h2>{{restaurant.Name}}</h2>
<h3>{{restaurant.Description}}</h3>
<button ion-button clear item-end (click)="gotoPage(restaurant)">View</button>
</ion-item>
</ion-list>
</ion-content>
And i know in the service method i have done nothing but just returned the value getting form the Firebase API. What i want is to know how could i iterate through the keys inside s@g,com and show the data inside each key in my HTML page as a list. I have tried it using map operator as well, but i couldn't find a better solution in angularfire2 5.0.0-rc.2.
