I am using FireStore Realtime Database in Angular.
I want to show a progressbar till the data loads from the database, and hide it after it loads.
This is my code:
export class KavPatuachChatComponent implements OnInit, AfterViewChecked {
messagesCollection: AngularFirestoreCollection<MessageItem>;
messages: Observable<MessageItem[]>;
mAuthService: AuthService;
constructor(public afs: AngularFirestore, public authService: AuthService) {
this.mAuthService = authService;
}
ngOnInit() {
this.getChatData();
}
getChatData() {
this.messagesCollection = this.afs.collection<MessageItem>('chat_messages', ref => ref.orderBy('DateTime'));
this.messages = this.messagesCollection.valueChanges();
}
How do I know when the data loads, in order to hide the progress bar then?