benyusouf
benyusouf

Reputation: 465

Reading data from firebase in ionic 3

I want read data from firebase database with ionic 3

I'm using this code but it's giving me error property subscribe does not exist on type AngularFireObject

this.db.object('/incident').subscribe(data => {

this.items = data;

  })

Meanwhile I was able to send data to the firebase using the following code

sendIncident(){

this.db.list('/incident').push({
    title: this.title.value,
    detail: this.detail.value
})
 }

I will appreciate any idea on how to overcome this

Upvotes: 0

Views: 1425

Answers (2)

Kachailo Dmytro
Kachailo Dmytro

Reputation: 11

You have to use something like this:

this.subscription = this.db.list('/notes').valueChanges().subscribe(data =>{
 })

Upvotes: 1

Hareesh
Hareesh

Reputation: 6900

I am not using ionic but angular with angularfire, but this should work for you

this.items = this.db.object('/incident').valueChanges();

Upvotes: 1

Related Questions