我有路由问题。
当我在 url 'myapp.com/route' 中添加一个斜杠时,最后像 'myapp.com/route/' 我的资源从 'myapp.com/route/...' 加载。
例如:我有必须从“myapp.com/starwars.js”加载的库,但使用斜杠将从“myapp.com/route/starwars.js”加载。 http://prntscr.com/9gpeen
但是没有斜线是正常的 http://prntscr.com/9gpepv
代码
import {Component} from 'angular2/core';
import {Route, RouteConfig, ROUTER_DIRECTIVES} from 'angular2/router'
import {NotFound} from './notfound/notfound';
import {TimerComponent} from './timer/timer.component'
@Component({
selector: 'my-app',
template:`
<a [routerLink]="['Timer']">Timer</a>
<router-outlet></router-outlet>
`,
directives: [ROUTER_DIRECTIVES]
})
@RouteConfig([
{ path: 'timer/', name: 'Timer', component: TimerComponent},
new Route({path: '/**', component: NotFound})
])
export class AppComponent { }
谢谢您的回答!