Retrieve data from firebase


#1

Cannot display data from firebase (realtime).
Getting error Object Object.

My Database

mydb-204020

shoppingItems
    (+) 0XJiBv8IOMbroaG0a43fdvbkUtT2
    (+) 0f9wKVBAKefF28jwLB2o8lKjni03
    (-) 0gUdjDEkg7gPI7fYgiu12r3GoYD3
          (-)  -L4M1N3RdBuoSMqVGlXS
                info1: 15155
                info2: "AM3 CPUs and dual channel DDR3 RAM"
          (-)  -L8CvlZnNjXKAQQ6N6fB
                info1: 15145
                info2: "ATI Radeon HD 4250 GPU video playback capability"
          (-)  -L3rr0b2ItLYzGJSzxD2
                info1: 12345
                info2: "the Gigabyte GA-880GM-UD2H guarantees"
    (+) 2HHkdOTH6tUCevXTW22EnpO9IOC2

homepage.ts

export class HomePage {
   shoppingItems: FirebaseListObservable<any[]>;
   constructor(public navCtrl: NavController, public firebaseProvider: FirebaseProvider) { 
      this.shoppingItems = this.firebaseProvider.getShoppingItems();
   }
}

homepage.html

    <ion-list>
      <ion-item-sliding *ngFor="let item of shoppingItems">
        <ion-item>
          {{ item.info2 }}
        </ion-item>
      </ion-item-sliding>
    </ion-list>

firebase.ts

  getShoppingItems() {

              this.userId = '0gUdjDEkg7gPI7fYgiu12r3GoYD3';
              this.url = '/shoppingitems/'+ this.userId;            

              const afList = this.afd.list(this.url);
              this.listObservable = afList.snapshotChanges();
              this.listObservable.subscribe();    
          
              return this.listObservable;
  }

#2

Anyone like to help me please!

#1
Everywhere I can see Firestore examples. But I want to continue with firebase realtime, as Firestore is not ready yet.
Need to recreate my existing app urgently.

#2
All the code examples looks like not working, because angularfire etc updated.


#3

Finally I got some clue from https://stackoverflow.com/questions/49355529/ionic-angularfirelist-snapshotchanges
and able to make my code working :smiley:


#4

Oops!!! again, cannot create apk