Reusable component & pipe for http error rendering
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { Pipe, PipeTransform } from '@angular/core';
|
||||
|
||||
@Pipe({ name: 'httpErrorMsg' })
|
||||
export class HttpErrorPipe implements PipeTransform {
|
||||
transform(e: HttpErrorResponse | null): string {
|
||||
return e ? `${e.status}: ${e.statusText}` : '';
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user