3
我有路由問題。Angular2路由。在網址結尾的斜線
當我在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 { }
謝謝您的解答!
這是問題對我來說,我的 標籤是在錯誤的地方,哎呦!謝謝! –
trickpatty