mirror of
https://github.com/akveo/ngx-admin.git
synced 2025-12-23 02:40:14 +01:00
app state
This commit is contained in:
parent
e6be0e4519
commit
38e1c6cfa3
8 changed files with 62 additions and 57 deletions
|
|
@ -1,7 +1,6 @@
|
|||
import {Component} from '@angular/core';
|
||||
import {Subscription} from "rxjs/Subscription";
|
||||
|
||||
import {ThemeGlobal} from "../../../theme";
|
||||
import {AppState} from "../../../app.state";
|
||||
|
||||
@Component({
|
||||
selector: 'content-top',
|
||||
|
|
@ -10,16 +9,10 @@ import {ThemeGlobal} from "../../../theme";
|
|||
})
|
||||
export class ContentTop {
|
||||
activePageTitle = '';
|
||||
private _themeGlobalSubscription:Subscription;
|
||||
|
||||
constructor(private _themeGlobal:ThemeGlobal) {
|
||||
this._themeGlobalSubscription = this._themeGlobal.getDataStream().subscribe((data) => {
|
||||
this.activePageTitle = data['menu.activeLink'] != null ? data['menu.activeLink'].title : this.activePageTitle;
|
||||
constructor(private _state:AppState) {
|
||||
this._state.subscribe('menu.activeLink', (activeLink) => {
|
||||
this.activePageTitle = activeLink.title;
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
// prevent memory leak when component destroyed
|
||||
this._themeGlobalSubscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue