Currently, I'm in the process of developing an Angular 2+ application that requires routing. One of the requirements is for the color scheme of the entire app to change based on a URL parameter input.
In my app.module.ts
file, I have the following code snippet:
const appRoutes: Routes = [
{ path: 'main/:key', component: MainComponent }
];
@NgModule({
imports: [
RouterModule.forRoot(appRoutes)
]
})
However, when attempting to access:
http://localhost:4200/main/someKey
or
http://localhost:4200/main?key=someKey
,
the path does not match and results in a 404 error.
It seems like setting up URL parameters should be straightforward. Any suggestions as to why it's not functioning as expected?