I need your help to implements my 404 component for child route with id, without redirection to a "404" page. This child route has a resolver that fetches my API. When the API return a 404, I want to redirect to show my 404 component but without redirection.
Here's my code:
routing.module.ts
const route = [
...
{
path: ':id',
component: ChildComponent,
resolve: {
data: ChildResolver,
},
},
{
path: '**',
pathMatch: 'full',
component: ErrorPageComponent,
},
...
child resolver
...
public resolve(route: ActivatedRouteSnapshot): Observable<ChildItem> {
return this.fetch(route.params.id);
}
...
NB: ErrorPageComponent
is a dumb component who just displays the error message.
Ps: Sorry for my English, I'm French.
Thanks a lot, Best regards William