繁体   English   中英

如何为使用 AngularFire 制作的 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM