当我添加侧栏时,它将显示一个空白页。它不会给我任何错误信息。如果我移除它,它就会恢复正常。
home.component.html
<nb-layout windowMode>
<nb-layout-header fixed>
<nb-form-field>
<nb-icon nbPrefix icon="search-outline"></nb-icon>
<input type="text" nbInput fullWidth shape="round" placeholder="Search">
</nb-form-field>
<button nbButton outline shape="round" size="medium" status="primary"><nb-icon icon="plus-outline"></nb-icon>Upload</button>
<nb-actions>
<nb-action title="Messages" icon="message-circle-outline" badgeDot badgePosition="top right" badgeStatus="danger"></nb-action>
<nb-action title="Notifications" icon="bell-outline" badgeDot badgePosition="top right" badgeStatus="danger"></nb-action>
</nb-actions>
<nb-user size="medium" name="Tzuyu Chou" picture="https://i.pinimg.com/originals/98/98/c6/9898c6313b8270b8dcc4269c47c3ef9a.jpg"></nb-user>
</nb-layout-header>
<nb-sidebar></nb-sidebar>
<nb-layout-column>Content</nb-layout-column>
</nb-layout>home.module.ts
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { HomeComponent } from './home.component';
import { NbActionsModule, NbButtonModule, NbContextMenuModule, NbFormFieldModule, NbIconModule, NbInputModule, NbLayoutModule, NbMenuModule, NbSearchModule, NbSidebarModule, NbTabsetModule, NbUserModule } from '@nebular/theme';
import { RouterModule } from '@angular/router';
@NgModule({
declarations: [
HomeComponent
],
imports: [
CommonModule,
RouterModule,
NbLayoutModule,
NbActionsModule,
NbIconModule,
NbContextMenuModule,
NbTabsetModule,
NbButtonModule,
NbSearchModule,
NbUserModule,
NbFormFieldModule,
NbInputModule,
NbSidebarModule,
NbMenuModule,
]
})
export class HomeModule { }我只想在我的项目中添加一个侧栏。我遵循文档中的代码,但仍然无法工作。
发布于 2022-11-29 17:04:59
将NbSidebarService添加到提供程序列表中
@NgModule({
...
providers: [NbSidebarService],
...
})
export class AppModule {}https://stackoverflow.com/questions/74614703
复制相似问题