I was looking through some code and found this:
this.busy = this.service.getInfo().subscribe((info: InfoData[]) => {
this.setInfo(info);
});
Now busy
is a component's property of type boolean
which is used as input value for [ngBusy]
directive. Obviously, subscribe()
returns a Subscription
, which is not null and therefore is cast to true
. This triggers directive to show modal loading popup, which goes away once info is resolved. That means, that this.busy
is false by that moment, which I have to mean that Subscription
object exists no more.
Inside getInfo()
method there is only one line, which is return Observable.of(info)
, where info is stub variable.
So my question is:
Is Subscription
deleted automatically right after data is resolved? If yes, is it only for Observable.of()
or are there any other examples of such behavior?