I'm trying to implement routing in my Angular 2 application. My objective is to be able to use the browser address bar to display a specific object by the id.
Here are my routes:
export const appRoutes: Routes = [
{
path: 'intervention/:id',
component: InterventionMainDisplay
},
{
path: 'intervention',
component: InterventionMainDisplay
}
];
I don't understand why when i enter in the browser address bar: http://localhost:3000/intervention or http://localhost:3000/intervention/15893 .. none of my routes are matched.
In the index.html I have <head><base href="/" />
I checked the router module configuration is loaded:
@NgModule({
imports: [
RouterModule.forRoot (appRoutes) ], ...
Here is the full error:
Uncaught (in promise): Error: Cannot match any routes. URL Segment: ''
Error: Cannot match any routes. URL Segment: ''
at new Error (native)
at ApplyRedirects.noMatchError