[英]How do you detach an onSnapshot listener from Firebase Firestore
[英]How to detach a listener for a Firestore collection made with AngularFire?
这是我收听收藏的观察者。
interface Scientist {
name?: string | null,
born?: number | null,
accomplishment?: string | null
};
export class AppComponent {
scientist$: Observable<Scientist[]>;
constructor(public firestore: Firestore) {
this.scientist$ = collectionData(collection(firestore, 'scientists'));
}
}
效果很好,但我如何分离监听器?
unsubscribe
是一个订阅接口,由this.scientist$.subscribe(...)
返回。 目前看来this.scientist$
目前被认为是 Observable 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.