When the components class isn't referenced anywher anymore it will be garbage collected and your subscription with it (when no other class holds a reference to it)
On Friday, April 15, 2016 at 6:07:41 PM UTC+2, Brian Kotek wrote: > > One thing that I'm not clear on is whether I'm required to manually > dispose Observable subscriptions I set up in a component. > > For example say I do this in ngOnInit(): > this.someService.somethingChanged.subscribe( ( value ) => > this.onSomethingChanged( value ) ); > > Am I required to store that subscription and manually dispose() of it in > ngOnDestroy()? And if I fail to do this, am I introducing a memory leak? > > Thanks, > > Brian > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
