0

I have an observable, which comes from @Input:

@Input()
public obs$: Observable<any>;

in OnInit I have subscribed to it. But when I unsubscribe it OnDestroy, some HTTP calls remain unfinished. If I doesn't unsubscribe in any place, after second onInit there are 2 subscriptions and some HTTP calls called twice.

How to resolve this problem?? Where and how to unsubscribe??

  • 1
    https://stackoverflow.com/questions/38008334/angular-rxjs-when-should-i-unsubscribe-from-subscription – martin Feb 16 '21 at 13:18
  • 2
    Otherwise make a reproducible demo on stackblitz that reproduces the issue. It's hard to give any advice just like that because unsubscribing definitelly does work. – martin Feb 16 '21 at 13:19
  • If you want an action to be separate from the lifecycle of a component, put it in a service. – Mrk Sef Feb 16 '21 at 14:40

0 Answers0