I'm following the Angular 2 Tour of Heroes
<https://angular.io/docs/ts/latest/tutorial/toh-pt5.html> tutorial, and I
have a problem when trying to access a route with parameters. This is my
routes definition:
RouterModule.forRoot([
{
path: '',
redirectTo: '/dashboard',
pathMatch: 'full'
},
{
path: 'dashboard',
component: DashboardComponent
},
{
path: 'detail/:id',
component: HeroDetailComponent
},
{
path: 'heroes',
component: HeroesComponent
}
])
This is my index.html:
<!DOCTYPE html>
<html>
<head>
<title>Angular QuickStart</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
<link rel="icon" href="favicon.ico">
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('app').catch(function(err) { console.error(err); });
</script>
<base href="/">
</head>
<body>
<my-app>Loading AppComponent content here ...</my-app>
</body>
This is the output of my browser console when I try to access through the
address bar the detail route with a certain id:
GET http://localhost:3000/detail/styles.css
GET http://localhost:3000/detail/node_modules/core-js/client/shim.min.js
GET http://localhost:3000/detail/node_modules/zone.js/dist/zone.js
GET http://localhost:3000/detail/node_modules/systemjs/dist/system.src.js
GET http://localhost:3000/detail/systemjs.config.js 404 (Not Found)Uncaught
ReferenceError: System is not defined
at 1:18
As you can see, the routes displayed in the console are wrong, because they
contain the detail segment. The other two routes are working fine. I don't
understand why
I'm having this problem, since I specified a base href in my main HTML
file. The app runs on lite-server.
Thanks.
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.