【发布时间】:2023-04-09 21:52:02
【问题描述】:
Angular2 LazyLoading 当我点击 Link its Loading Its component,Htmlpages,Modules 但在 <router-outlet> 中不显示 Html 页面
母版页
<a [routerLink]="['Customer/Add']">Customer</a><br />
<a [routerLink]="['Employee/Add']">Employee</a><br />
<router-outlet>
</router-outlet>
客户组件
import { Component } from "@angular/core"
@Component({
templateUrl: '../../ui/customer/customer.html'
})
export class CustomerComponent {
}
客户模块
@NgModule({
imports: [RouterModule.forChild(CustomerRoute), ReactiveFormsModule, CommonModule, ReactiveFormsModule, FormsModule, HttpModule],
declarations: [CustomerComponent],
bootstrap: [CustomerComponent]
})
export class CustomerModule {
}
客户路线
import { Component } from "@angular/core"
import { CustomerComponent } from "../components/customer/customercomponent"
export const CustomerRoute = [
{ path: "Add", Component: CustomerComponent}
]
主路由
import { Component } from "@angular/core"
import { Routes } from "@angular/router"
import { HomePageComponent } from "../components/homepage/homepage"
export const ApplicationRoutes= [
{ path: '', component: HomePageComponent },
{ path: 'UI/MasterAngularPage.html' ,component: HomePageComponent },
{ path: 'Customer', loadChildren: '../modules/customermodule/customermodule#CustomerModule'},
]
【问题讨论】:
标签: angular2-routing angular4-router