【发布时间】:2017-11-26 22:46:46
【问题描述】:
我在 Angular 中使用 FireStore 实时数据库。
我想在从数据库加载数据之前显示一个进度条,并在加载后将其隐藏。
这是我的代码:
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();
}
我如何知道数据何时加载,以便隐藏进度条?
【问题讨论】:
标签: angular