@delon/cli
Version:
Schematics for ng-alain
34 lines (29 loc) • 1.13 kB
text/typescript
import { Component, HostBinding, OnInit } from '@angular/core';
import { Router, NavigationEnd } from '@angular/router';
import { ThemesService, SettingsService, TitleService } from '@delon/theme';
import { filter, map } from 'rxjs/operators';
({
selector: 'app-root',
templateUrl: `./app.component.html`,
styleUrls: [ './app.component.less' ]
})
export class AppComponent implements OnInit {
('class.layout-fixed') get isFixed() { return this.settings.layout.fixed; }
('class.layout-boxed') get isBoxed() { return this.settings.layout.boxed; }
('class.aside-collapsed') get isCollapsed() { return this.settings.layout.collapsed; }
constructor(
private theme: ThemesService,
private settings: SettingsService,
private router: Router,
private titleSrv: TitleService) {
}
ngOnInit() {
this.router.events.pipe(
filter(evt => evt instanceof NavigationEnd),
map(() => this.router.url)
)
.subscribe(url => {
this.titleSrv.setTitleByUrl(url);
});
}
}