This generally occurs when there is a mismatch in the routes specified, or a component which is not present in our routing configuration, or if there is the use of multiple routes in our angular application which is not properly configured.
Generate an application with routing enabledlink The following command uses the Angular CLI to generate a basic Angular application with an application routing module, called AppRoutingModule , which is an NgModule where you can configure your routes.
Add pathMatch: 'full'
{path: '', component: AppComponent, pathMatch: 'full'},
to routes with empty path ''
and no child routes.
I am integrating Angular 2/4 into an existing MVC application, and I had this problem too.
Using your example, if I had path: 'Clients'
in the routing config instead of path: 'clients'
and tried to go to the URL such as http://localhost/clients
, I would get this error.
The route path names are case sensitive (as of right now anyway). They won't match what's in your URL otherwise, and with typical MVC controller/action naming, they are "InitialCaps-style."
Check the imports session at the app.module.ts and look you did't miss the routing:
imports: [
BrowserModule,
APP_ROUTES,
AppRoutingModule
],
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With