I'm trying the tutorial Angular2 tutorial, but it doesn't seem to understand the routes after a refresh. The source code can be found on https://angular.io/resources/live-examples/tutorial/ts/plnkr.html
@Component({
selector: 'my-app',
template: `
<h1>{{title}}</h1>
<a [routerLink]="['Dashboard']">Dashboard</a>
<a [routerLink]="['Heroes']">Heroes</a>
<router-outlet></router-outlet>
`,
styleUrls: ['app/app.component.css'],
directives: [ROUTER_DIRECTIVES],
providers: [HeroService]
})
@RouteConfig([
{path: '/dashboard', name: 'Dashboard', component: DashboardComponent, useAsDefault: true},
{path: '/heroes', name: 'Heroes', component: HeroesComponent},
{path: '/detail/:id', name: 'HeroDetail', component: HeroDetailComponent}
])
What it does is that it replaces the base /
by /dashboard
but when you refresh the page, I want it to understand that /dashboard
=== /dashboard
and not /
, because it thinks that it's the base directory, so the links shows /dashboard/dashboard
and the ts are failing to load as they are included in relative way.