mirror of
https://github.com/akveo/ngx-admin.git
synced 2026-03-10 07:32:36 +01:00
menu collapsed state implemented using observer
This commit is contained in:
parent
5817744a37
commit
6a7266ddb3
3 changed files with 57 additions and 21 deletions
21
src/app/theme/sidebar/sidebarState.service.ts
Normal file
21
src/app/theme/sidebar/sidebarState.service.ts
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
import {Injectable} from 'angular2/core'
|
||||
import {Subject} from 'rxjs/Subject';
|
||||
|
||||
@Injectable()
|
||||
export class SidebarStateService {
|
||||
|
||||
// Observable string sources
|
||||
private _isCollapsed = new Subject<boolean>();
|
||||
|
||||
// Observable string streams
|
||||
isCollapsedStream$ = this._isCollapsed.asObservable();
|
||||
|
||||
// Service message commands
|
||||
stateChanged(isCollapsed: boolean) {
|
||||
this._isCollapsed.next(isCollapsed)
|
||||
}
|
||||
|
||||
getStateStream() {
|
||||
return this.isCollapsedStream$;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue