Skip to content
This repository was archived by the owner on Aug 25, 2018. It is now read-only.

retrieve data from firebase database #75

Open
asifaathwal opened this issue Apr 12, 2018 · 0 comments
Open

retrieve data from firebase database #75

asifaathwal opened this issue Apr 12, 2018 · 0 comments

Comments

@asifaathwal
Copy link

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

{{ item.catagory}} //this is the list where i want to show the item

}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant