Unsubscribing in Angular NGXS

Joseph

I’m new to NGXS in Angular and I have read that you don’t need to unsubscribe when you use the async pipe. However I’m also subscribing from the queryParams and I’m subscribing from the dispatches action. Do I need to unsubscribe from this 2 codes below?

this.route.queryParamMap
 .pipe(map(params => params.get('page')))
 .subscribe((page: any) => {
   this.page = page;
   console.log(page);
  });

this.store.dispatch(new AddEmployee(form.value)).subscribe(() => {
 form.reset();
 this.modalReference.close(); 
Joseph

The answer is don't need to unsubscribe from these two set of codes. Because routes are handled by Angular and second, the store is handled by ngxs. No need to unsubscribe. Unsubscribe only when using rxjs

GitHub: Does I need to unsubscribe on distaching actions?

amcdnl commented on Jul 3, 2018

Nope. Its handled for you.,

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related