Open asifaathwal opened 6 years ago
import { Component } from '@angular/core'; import { IonicPage, NavController, NavParams } from 'ionic-angular'; import firebase from 'firebase'; import { AngularFireAuth } from 'angularfire2/auth'; import { AngularFireDatabase } from 'angularfire2/database';
/**
@IonicPage() @Component({ selector: 'page-catagory', templateUrl: 'catagory.html', }) export class CatagoryPage {
public items: Array = []; public itemRef: firebase.database.Reference = firebase.database().ref('/foodcatagory');
constructor(public navCtrl: NavController, public navParams: NavParams, public afDb: AngularFireDatabase) { } ionViewDidLoad() { this.itemRef.on('value', itemSnapshot => { this.items = []; itemSnapshot.forEach( itemSnap => { this.items.push(itemSnap.val()); return false; }); }); }
//this is the list where i want to show the item
}
catagory.ts
i am using this fuction to retrieve data from firebase ....but it cannot show any data
import { Component } from '@angular/core'; import { IonicPage, NavController, NavParams } from 'ionic-angular'; import firebase from 'firebase'; import { AngularFireAuth } from 'angularfire2/auth'; import { AngularFireDatabase } from 'angularfire2/database';
/**
@IonicPage() @Component({ selector: 'page-catagory', templateUrl: 'catagory.html', }) export class CatagoryPage {
public items: Array = [];
public itemRef: firebase.database.Reference = firebase.database().ref('/foodcatagory');
constructor(public navCtrl: NavController, public navParams: NavParams, public afDb: AngularFireDatabase) { } ionViewDidLoad() { this.itemRef.on('value', itemSnapshot => { this.items = []; itemSnapshot.forEach( itemSnap => { this.items.push(itemSnap.val()); return false; }); }); }
catagory.html
//this is the list where i want to show the item
}