0

When I do this:

comments: Comment[] | undefined;
loadComments(){
this.http.get<Comment[]>(`${this.apiServerUrl}`, options).subscribe(
      (response: Comment[]) => this.comments = response
    );
}

How can I unsubscribe on this, and made my output in html file static? Problem is that, in my project, I have a lot of subscribes and when I start my app, it eat my RAM so hard.

  • Does this answer your question? [Is it necessary to unsubscribe from observables created by Http methods?](https://stackoverflow.com/questions/35042929/is-it-necessary-to-unsubscribe-from-observables-created-by-http-methods) – Anton Hirov Jan 15 '22 at 21:19

1 Answers1

1

Actually you do not have to unsubscribe from http observables. It completes as soon as response arrives.