Reputation: 63
I am subscribing to Firestore's document "this.afs.collection('messaging').doc(email);" which is located in NgOnInit(). Once I Create another document in Firestore, I want to refresh the data. I am a little confused on the best way to do this. I have tried "window.location.reload()" and my POST operation does not follow through. I have also tried using changeDetector which has not helped as well.
COMPONENT
ngOnInit(){
const doc = this.afs.collection('messaging').doc(email);
doc.subscribe( usersData => { this.users = usersData });
`
`
TEMPLATE
<ng-container *ngFor="let user of users;index as i">
{{user.payload.doc.data().displayName}}
</ng-container>
`
Upvotes: 0
Views: 341
Reputation: 11478
According to the pattern I assume you use @angular/fire
. Plus, you're dealing here with websockets behind the scene meaning that everything that happens here occurs in real-time. Meaning, you don't have to refresh anything.
Upvotes: 1