Is it necessary to unsubscribe from observables created by Http methods?
问题 Do you need to unsubscribe from Angular 2 http calls to prevent memory leak? fetchFilm(index) { var sub = this._http.get(`http://example.com`) .map(result => result.json()) .map(json => { dispatch(this.receiveFilm(json)); }) .subscribe(e=>sub.unsubscribe()); ... 回答1: So the answer is no, you don't. Ng2 will clean it up itself. The Http service source, from Angular's Http XHR backend source: Notice how it runs the complete() after getting the result. This means it actually unsubscribes on