How to render specific data from firebase and Ionic 3


#1

Hello,
Currently I am working on an Ionic 3 project and has firebase database. I am able to retrieve all data from table and user for to display them in HTML. But got no luck in displaying data for specific id and also with where condition.

query = SELECT * FROM users - working great

query1 = SELECT * FROM users WHERE id = ‘some id’ - not working

query2 = SELECT * FROM users WHERE status = 1 - not working

Here is my user provider

I have created a render Users function to retreive all user data,

renderUsers(): Observable<any> {

    return new Observable(observer => {
      let users: any = [];
      firebase.database().ref('users').orderByKey().once('value', (items: any) => {
        items.forEach((item) => {
          users.push({
            id: item.key,
            email: item.val().email,
            password: item.val().password,
            image: item.val().image,
          });
        });

        observer.next(users);
        observer.complete();
      },
        (error) => {
          console.log("Observer error: ", error);
          console.dir(error);
          observer.error(error)
        });

    });
  }

my profile.ts

  loadAndParseUser() {
      this.user = this._DBUSER.renderUsers();
      console.log(this.user);
      this._LOADER.hidePreloader();
    }

profile.html

<ion-col col-12  *ngFor="let u of user | async">
          <h5>{{u.email}}</h5>