In my early Angular days, I would subscribe to observables without unsubscribing before the app was destroyed, possibly leading to a build up of memory leaks. For example:
class AppComponent implements OnInit {
myData: MyDataType[];
constructor(private httpClient: HttpClient){ }
ngOnInit() {
this.httpClient
.get('/api/my-data')
.subscribe((data: MyDataType[]) => {
myData = data;
});
}
}
#angular-subscription #angular #typescript #angular-tutorial #rxjs