Using Angular in Ionic 3 I am getting this error in my project. When I will try to retrieve realtime data from firebase using angular 4 in ionic 3, it getting this error “property ‘subscribe’ does not exist on type AngularFirelist”. How can I fix this error?
I have followed this code:
this._chatSubscription = this.db.list("/chat/"+this.company+"/group_chat").subscribe( data => { this.messages = data; console.log(this.messages); });
‘subscribe’ does not exist on type AngularFirelist, you have to use valueChanges() or snapshotChanges()
For example:
this._chatSubscription = this.db.list("/chat/"+this.company+"/group_chat").snapshotChanges().subscribe( data => { this.messages = data; console.log(this.messages); });
Or:
this._chatSubscription = this.db.list("/chat/"+this.company+"/group_chat").valueChanges().subscribe( data => { this.messages = data; console.log(this.messages); });
Question and answer is powered by AnsPress.io