我收到此错误,却不知道为什么。我希望你能帮助我。 我用“ Localhost:4200 / Admin / Lastrecords”调用了URL。
错误错误:未捕获(承诺):错误:无法匹配任何路由。 URL段。“最后记录”
parent.module
@NgModule({
declarations: [
AppComponent,
InfoComponent,
LoginComponent,
ProtectedComponent,
DropdownDirective,
MainComponent
],
imports: [
BrowserModule,
routing,],
...
export class AppModule { }
parent.router
const APP_ROUTES: Routes = [
{path: '', component: LoginComponent},
{path: 'Admin', component: DashboardComponent, loadChildren: './admin/admin.module#AdminModule'},
];
export const routing = RouterModule.forRoot(APP_ROUTES);
child.module
@NgModule({
declarations: [
DashboardComponent,
NewAccComponent,
KeyComponent,
LastLoginComponent,
RecordComponent
],
imports: [
routdash,
FormsModule,
],
export class AdminModule {
}
child.routing
const DASH_ROUTES: Routes = [
{path: '', component: LastLoginComponent, outlet: 'sec'},
{path: 'Lastlogins', component: LastLoginComponent, outlet: 'sec'},
{path: 'Lastrecords', component: RecordComponent, outlet: 'sec'},
];
export const routdash = RouterModule.forChild(DASH_ROUTES);
答案 0 :(得分:1)