How to detach a listener for a Firestore collection made with AngularFire?

Viewed 31

Here's my observer that listens to a collection.

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'));
  }
}

Works great but how do I detach the listener?

1 Answers

unsubscribe is an interface for subscription, which is returned by this.scientist$.subscribe(...). It seems currently this.scientist$ is currently considered Observable instead.

Related