mirror of
https://github.com/akveo/ngx-admin.git
synced 2026-01-13 13:08:51 +01:00
Fixed problems with the sidebar service. Switched to use "path" concept instead of component
This commit is contained in:
parent
31efdaa1f1
commit
f24546639c
4 changed files with 57 additions and 44 deletions
|
|
@ -1,10 +1,9 @@
|
|||
import {Component, ElementRef, HostListener, ViewEncapsulation} from '@angular/core';
|
||||
import {Router} from '@angular/router';
|
||||
|
||||
import {AppState} from '../../../app.state';
|
||||
import {layoutSizes} from '../../../theme';
|
||||
import {BaSlimScroll} from '../../../theme/directives';
|
||||
import {BaSidebarService} from './baSidebar.service';
|
||||
import {Component, ElementRef, HostListener, ViewEncapsulation} from "@angular/core";
|
||||
import {Router} from "@angular/router";
|
||||
import {AppState} from "../../../app.state";
|
||||
import {layoutSizes} from "../../../theme";
|
||||
import {BaSlimScroll} from "../../../theme/directives";
|
||||
import {BaSidebarService} from "./baSidebar.service";
|
||||
|
||||
@Component({
|
||||
selector: 'ba-sidebar',
|
||||
|
|
@ -35,7 +34,9 @@ export class BaSidebar {
|
|||
private _state:AppState) {
|
||||
|
||||
this.menuItems = this._sidebarService.getMenuItems();
|
||||
// this._onRouteChange = this._router.root.subscribe((path) => this._selectMenuItem());
|
||||
this._onRouteChange = this._router.events.subscribe(() => {
|
||||
this._selectMenuItem();
|
||||
});
|
||||
this._state.subscribe('menu.isCollapsed', (isCollapsed) => {
|
||||
this.isMenuCollapsed = isCollapsed;
|
||||
});
|
||||
|
|
@ -49,7 +50,7 @@ export class BaSidebar {
|
|||
}
|
||||
|
||||
public ngOnDestroy():void {
|
||||
// this._onRouteChange.unsubscribe();
|
||||
this._onRouteChange.unsubscribe();
|
||||
}
|
||||
|
||||
public ngAfterViewInit():void {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue