Ionic3 Angularfire listen to firestore changes

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP



Ionic3 Angularfire listen to firestore changes



how do I listen to event after firebase cloud function had successfully updated a document? Because there is a few seconds lag while the function is running. I want to implement a loading screen and dismiss it when the function successfully updated the record.




1 Answer
1



You can use the update or set method of Angularfire to change the value of a document. those methods return a Promise, when fulfilled you can remove hte loader.


update


set


Promise


updateItem()
this.loading = true;
const item = id: 1, name: "My Item ;
this.db.doc('item/1').update(item)
.then(() => this.loading = false;;



For more exmaples look at the angularfire documents documentation






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

Firebase Auth - with Email and Password - Check user already registered

Dynamically update html content plain JS

How to determine optimal route across keyboard