user$ = this.http.get<User[]>(url).pipe( tap(data => console.log(JSON.stringfy(data))), catchError(this.handleError) ) privat handleError(err: HttpErrorResponse): Observable<never>{ let errorMsg = `An error occurred: ${err.error.message}`; console.log(err); return throwError(()=> errorMsg) }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter