我是新来的角路由器,请看下面的代码;无法匹配任何路由角
export const appRoutes: Routes = [{
path: '',
component: GridComponent,
outlet: 'center'
},{
path: 'login',
component: LoginComponent,
outlet: 'center'
}];
@NgModule({
imports: [RouterModule.forRoot(appRoutes, { useHash: true })],
exports: [RouterModule]
})
export class AppRoutingModule { }
app.html
--------
<header></header>
<router-outlet name="center"></router-outlet>
<footer></footer>
当我打http://localhost:59050/#/login
我收到以下错误Cannot match any routes. URL Segment: 'login'
但是当我打http://localhost:59050/#/
它显示了gridcomponent。我也曾经使用和未使用<base href="/" >
。任何帮助是极大的赞赏。
你使用辅助路线吗? – Hareesh
你可以试试'http:// localhost:59050 /#/ login(center:)'? –