Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

303
Views
How to route to error page without leaving the current page in Angular

I have running Angular 9 application and as per the correct implementation, if any unhandled exception occurs, I am routing to error page.

@Injectable()
export class CustomErrorHandler implements ErrorHandler {
   handleError(errorObj) {
      router.navigate(['/error'], { queryParams: { error: JSON.stringify(errorDetails) } })
   }
}

I am using ErrorHandler class and want to display error page as overlay , where in error page will be displayed on top of the current page and in background the current page should still be shown.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I recommend you to use the dialog from Angular Material

Imports:

import { MatDialog } from '@angular/material'; 

Constructor:

constructor(
  private dialog: MatDialog,
) { }

Function to display the dialog:

error() {
 const dialogRef = this.dialog.open(CustomErrorHandler, {
   width: '70%', // Make this as big as you want
   data: { error: this.errorType } //Put here the data you want to display one the error page. If you dont need it just delete the line and the ,
 });
}

You can find more info here

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!