【发布时间】:2019-01-25 12:54:05
【问题描述】:
这是我的应用设置:
这是我的 app-routing.module.ts
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { SoftwareComponent } from './components/software/software.component';
const routes: Routes = [
{
path: '',
outlet: 'main',
component: SoftwareComponent,
children: [
{
path: 'personal',
children: [
{
path: '',
loadChildren: './components/software/data/personal/personal.module#PersonalModule'
}
]
}
]
}
];
@NgModule({
imports: [RouterModule.forRoot(routes, {enableTracing: true})],
exports: [RouterModule]
})
export class AppRoutingModule { }
我的错误是:
ERROR 错误:未捕获(在承诺中):错误:无法匹配任何路由。 URL 段:“个人” 错误:无法匹配任何路由。 URL 段:“个人”
也许有人能说出我的设置有什么问题?
【问题讨论】:
-
你试过
routerLink=['/personal']吗? -
不,等一下
-
你有 2 个引用路径
path: '' -
不起作用 kris,而 Jonas Praem 第一个空路径是主路由,另一个空路径是子路由 - 我认为如果你遵循官方没有任何错误文档 -> angular.io/guide/router#child-routing-component
标签: angular