我在我的有角项目https://github.com/ramsatt/ng6AdminLTE中使用Adimlte主题 在asp.netCore 2.2中使用Angular 8 1.如何在主题中添加多个组件 2.如何使用正确的组件布线 3.RouterLink无法在sideMenu中使用。然后我用href来显示页面,但是看起来不太好,我分享一些我正在做的代码。 //在app.module.ts中 const appRoutes:路线= [ {path:”,component:LoginComponent}, {path:'Dashboard',component:HomeComponent},
{
path: 'MainCategory',
component: HomeComponent,
children: [
{ path: '', component: MainCategoryComponent },
]
},
{
path: 'CustomerProfile',
component: HomeComponent,
children: [
{ path: '', component: CustomerProfileComponent },
]
},
{
path: 'SubMainCategory',
component: HomeComponent,
children: [
{ path: '', component: CustomerSubCatergoryComponent },
]
}
@NgModule({
declarations: [
AppComponent,
TopnavbarComponent,
AsidenavbarComponent,
FooternavbarComponent,
SettingsnavbarComponent,
LoginComponent,
HomeComponent,
MainCategoryComponent,
CustomerProfileComponent,
CustomerSubCatergoryComponent
], imports: [
BrowserModule.withServerTransition({ appId: 'ng-cli-universal' }),
ModalModule,
RouterModule,
CommonModule,
RouterModule.forRoot(appRoutes),
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
/////////////////////////////////////////////////
///In homecomponent.html
<div class="wrapper">
<app-topnavbar></app-topnavbar>
<app-asidenavbar></app-asidenavbar>
<div class="content-wrapper">
<section class="content-header">
<router-outlet></router-outlet>
</section>
</div>
<app-footernavbar></app-footernavbar>
<app-settingsnavbar></app-settingsnavbar>
</div>
//在Appcomponent.html
中