I am trying to get a user details from a angularFire2 database. Therefore instead of using the FirebaseListObservable, I am using FirebaseObjectObservable since I am expecting just a user from the path.
This is the path and the colums through which I am deriving the user data
path: /projects/users/
columns: userID,username
data
userID:"001",
username:"Icomin"
And this the home.ts
import { Component } from '@angular/core';
import { NavController,AlertController,ActionSheetController } from 'ionic-angular';
import{AngularFireDatabase,FirebaseListObservable,FirebaseObjectObservable} from 'angularfire2/database';
import {Observable} from 'rxjs/Observable';
@Component({
selector: 'my-child-component',
template: `<h1>Welcome {{ (projects | async)}}</h1>` // The template
})
export class HomePage{
projects: FirebaseObjectObservable <any>;
constructor(af:AngularFireDatabase) {
this.projects = af.object(`/projects/users`);
}
I implement the template below, however the returnsWelcome [object object]
The template implementation
template: `<h1>Welcome {{ (projects | async)}}</h1>`
How do I get the user details from the above path and set it into the template
/projects/users, which is a list of data. So your HTML will need to loop over that. Alternatively, make your code read a single user/projects/users/user1.