I\'ve implemented my custom error handler, and in that I want to re-direct to my custom error page that just says \"sorry, an error occurred......\".
I declared a ro
Main issue is that the routes var from the app-routing.module.ts has the entry to ** before the entry to error and the router will always go to **.
Moving the entry ** to the last place inside of routes will make the error entry reachable.
Also we found that after the updates the @Component({}) decorator of the CustomErrorComponent was removed.
Let's rollback that again and leave the CustomErrorComponent file with this code:
import { OnInit, Component } from '@angular/core';
@Component({
selector: "customErrorComponent",
templateUrl: './customerror.component.html'
})
export class CustomErrorComponent implements OnInit {
constructor() { }
ngOnInit() {
console.log('customErrorComponent | ngOnInit...');
}
}
Also we must add the CustomErrorComponent to the entryComponents of your main module.
Just add entryComponents: [CustomErrorComponent] to your main Module.
That did the job, future readers can check the chat thread of the question for more information.