mirror of
https://github.com/akveo/ngx-admin.git
synced 2026-01-24 02:06:11 +01:00
sidebar menu fixes
This commit is contained in:
parent
2603b8a9d0
commit
612071b97c
4 changed files with 21 additions and 7 deletions
|
|
@ -37,14 +37,20 @@ export class Sidebar {
|
|||
this._router.root.subscribe((path) => this._selectMenuItem(path));
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
if (this._shouldMenuCollapse()) {
|
||||
this.menuCollapse();
|
||||
}
|
||||
}
|
||||
|
||||
ngAfterViewInit() {
|
||||
this.updateSidebarHeight();
|
||||
}
|
||||
|
||||
@HostListener('window:resize', ['$event'])
|
||||
onWindowResize($event) {
|
||||
@HostListener('window:resize')
|
||||
onWindowResize() {
|
||||
|
||||
var isMenuShouldCollapsed = $event.target.innerWidth <= layoutSizes.resWidthCollapseSidebar;
|
||||
var isMenuShouldCollapsed = this._shouldMenuCollapse();
|
||||
|
||||
if (this.isMenuShouldCollapsed !== isMenuShouldCollapsed) {
|
||||
this.menuCollapseStateChange(isMenuShouldCollapsed);
|
||||
|
|
@ -94,6 +100,10 @@ export class Sidebar {
|
|||
return false;
|
||||
}
|
||||
|
||||
private _shouldMenuCollapse() {
|
||||
return window.innerWidth <= layoutSizes.resWidthCollapseSidebar;
|
||||
}
|
||||
|
||||
private _selectMenuItem(currentPath = null) {
|
||||
|
||||
let currentMenu = this._sidebarService.setRouter(this._router).selectMenuItem(this.menuItems, currentPath);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue