I have a BehaviourSubject defined in a service, and i point to that subject with a variable i define in another component, in that component's view i subscribe to the subject using that variable, example:
service:
public exampleSubjebt$ = new BehaviorSubject<boolean>(true);
component.ts:
ngOninit() {
let someVariable = this.service.exampleSubject$;
}
component's view:
<app-something [options]="someVariable | async"></app-something>
My question is, does the fact the the observable sits in the service and I call it directly from there using the variable, make it so that the async pipe will not unsubscribe on the component's destruction?
async
will always unsubscribe automatically. See also stackoverflow.com/questions/56033098/… – martin