akveo / akveo/nebular

NbMenu doesn't show when app load into child component, pls help me!

未关闭
#2,680 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
8.1k
派生
1.5k
PR 合并指标
30 天内没有已合并 PR

描述

### Issue type

**I'm submitting a ...** (check one with "x")

* [x] bug report
* [ ] feature request

### Issue description

**Current behavior:**
I'm using Lazy-Loading for my app, but when it loads into the child component, NbMenu is only shown with a component (IndexComponent), but the other component of the Post module (create, update, detail) doesn't work with NbMenu. I also implemented NbMenu in the Feature and Root module, but It hasn't worked. I don't know what happened

**Related code:**

RootModule
```
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule,
NbSidebarModule.forRoot(),
NbMenuModule.forRoot(),
NbThemeModule.forRoot()
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
```
AdminModule
```
@NgModule({
declarations: [AdminComponent],
imports: [
CommonModule,
AdminRoutingModule,
NbIconModule,
NbLayoutModule,
NbMenuModule,
NbSidebarModule,
NbEvaIconsModule,
PostModule,
NbDialogModule.forChild(),
NbWindowModule.forChild()
],
providers: [NbThemeService, NbSidebarService]
})
export class AdminModule { }
```
PostModule
```
@NgModule({
declarations: [PostComponent, CreateComponent, DetailComponent, UpdateComponent, IndexComponent],
imports: [
CommonModule,
NbCardModule,
NbButtonModule,
Ng2SmartTableModule,
NbIconModule,
HttpClientModule,
FormsModule,
NbMenuModule,
NbSidebarModule,
NbEvaIconsModule,
PostRoutingModule
],
providers: [PostService]
}
)
export class PostModule { }
```
PostRoutingModule
```
const routes: Routes = [
{
path: '', component: PostComponent, children: [
{ path: '', redirectTo: 'index', pathMatch: 'full' },
{ path: 'index', component: IndexComponent, pathMatch: 'full' },
{ path: 'create', component: CreateComponent, pathMatch: 'full' },
{ path: 'update', component: UpdateComponent, pathMatch: 'full'},
{ path: 'detail', component: DetailComponent, pathMatch: 'full'}
]
}
]

@NgModule({
imports: [
RouterModule.forChild(routes)
],
exports: [RouterModule],
}
)
export class PostRoutingModule { }
```

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。