HTTP
Inject in constructor private http: HttpClient
An Observable from HttpClient always emits a single value and then completes. HttpClient.get returns the body of the response as an untyped JSON object by default. Applying the optional type specifier, , gives you a typed result object. All HttpClient methods return an RxJS Observable of something
To make parameterized urls ${this.heroesUrl}/${id}
Update
Error Handling
catchError passes an error handler
Handle Http operation that failed.
Let the app continue.
@param operation - name of the operation that failed
@param result - optional value to return as the observable result
Last updated