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