I know that it's possible to set wildcard routes in Angular, but how is it possible to set "wildcard exceptions"? My main routing scope looks like this and works great:
{
...
},
{
path: '',
component: HomeComponent,
},
{
path: '**',
component: NotFoundComponent,
}
But I also have a non-Angular component unter /admin. This admin-path is well configured in my nginx config and also works. But now comes the problem:
- open a new browser and access
/admin-> admin works - open a new browser and access
/-> Angular app works - open my app (2) and now modify the url in the address bar of the Chrome browser to
/admin-> doesn't open my admin butNotFoundComponent
I guess that any caching mechanism of the browser and/or Angular is now activated, that it assumes that is an Angular component too. For that reason I'm looking for a way to tell the Angular router that /admin is NOT part of the Angular app and that the nginx-config has to be used.
How can I achieve this?
--- EDIT ---
I also tried the solution proposed here in the forum, which looks like this:
{
path: 'admin',
canActivate: [externalUrlProvider],
component: NotFoundComponent,
},
@NgModule({
...
providers: [
{
provide: externalUrlProvider,
useValue: (route: ActivatedRouteSnapshot) => {
let externalUrl = '/' + route.url.toString();
window.open(externalUrl, '_self');
},
},
],
})
But this one results in an endless loop: open a window again and again ...