Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | 118x 8x 8x 8x 11x 6x 5x 5x 5x 5x 5x 5x 4x 4x 4x 110x | import { Location } from '@angular/common';
import { HttpErrorResponse } from '@angular/common/http';
import { Component, Input, OnChanges, inject } from '@angular/core';
import { RouterLink, Router } from '@angular/router';
@Component({
selector: 'app-error',
imports: [RouterLink],
templateUrl: './error.component.html',
styleUrl: './error.component.scss'
})
export class ErrorComponent implements OnChanges{
private location = inject(Location);
private router = inject(Router);
@Input() error: HttpErrorResponse;
@Input() customResourceName: string | undefined = undefined;
resourceName: string;
ngOnChanges(){
if (this.customResourceName !== undefined) {
this.resourceName = this.customResourceName;
}
else {
let segment = this.error.url?.split('/')[3];
Eif (segment !== undefined){
Eif (segment.endsWith('s')){
segment = segment.slice(0, -1);
}
this.resourceName = segment.charAt(0).toUpperCase() + segment.slice(1);
this.resourceName = this.resourceName.replace('-', " ");
}
}
}
goBack(){
this.location.back();
}
reloadPage() {
const currentUrl = this.router.url;
this.router.navigateByUrl('/', { skipLocationChange: true }).then(() => {
this.router.navigate([currentUrl]);
});
}
}
|