Bit of a weird one... I'm not sure if this is well-known or just me 🤣 Either way, it's a good thing to know!
Issue
Routes suddenly stopped working. When trying the access http://localhost:4200/teamcity/builds
I would see the page not found view instead.
const teamCityRoutes: Routes = [
{ path: '', component: TeamCityComponent },
{ path: '', redirectTo: '/', pathMatch: 'full' },
{ path: '**', component: PageNotFoundComponent }, // ✨
{ path: 'builds', component: BuildsComponent }
];
Fix
Order of the PageNotFoundComponent route. I can now the the builds view as expected.
const teamCityRoutes: Routes = [
{ path: '', component: TeamCityComponent },
{ path: '', redirectTo: '/', pathMatch: 'full' },
{ path: 'builds', component: BuildsComponent },
{ path: '**', component: PageNotFoundComponent } // 😇
];
Top comments (1)
Yes, I faced this problem once before,
And I think in all practical guides that you can find on the web
They always consider the order of the routes