【发布时间】:2017-07-12 18:30:40
【问题描述】:
我需要使用 ng-sidebar 在点击标题中的按钮时在左侧显示一个可折叠的侧边栏菜单。
app.component.html
<div class="page-header custom-phead">
<ng-sidebar-container>
<ng-sidebar [(opened)]="_opened">
<p>Sidebar contents</p>
</ng-sidebar>
<div ng-sidebar-content>
<button (click)="_toggleSidebar()">Toggle</button>
</div>
</ng-sidebar-container>
<form class="heading">
<input type="text" name="search" [(ngModel)]="search"><input type="image" [src]="'../resource/searchicon.png'">
</form>
</div>
而在 app.component.ts 中,
private _opened: boolean = false;
private _toggleSidebar() {
this._opened = !this._opened;
}
问题是,按钮根本没有反映在屏幕上,此外,没有任何反应。请帮忙解决这个问题。
【问题讨论】:
-
提供您的
app.module.ts。你在那里导入了SidebarModule? -
是的,我都做到了
标签: javascript angular angular-directive