|  |  |  | 
|---|
|  |  |  | import { Component } from '@angular/core'; | 
|---|
|  |  |  | 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'; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Component({ | 
|---|
|  |  |  | selector: 'app-root', | 
|---|
|  |  |  | templateUrl: './app.component.html', | 
|---|
|  |  |  | styleUrls: ['./app.component.css'] | 
|---|
|  |  |  | template: `<router-outlet></router-outlet>` | 
|---|
|  |  |  | }) | 
|---|
|  |  |  | export class AppComponent { | 
|---|
|  |  |  | title = 'app'; | 
|---|
|  |  |  | export class AppComponent implements OnInit { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @HostBinding('class.layout-fixed') get isFixed() { return this.settings.layout.fixed; } | 
|---|
|  |  |  | @HostBinding('class.layout-boxed') get isBoxed() { return this.settings.layout.boxed; } | 
|---|
|  |  |  | @HostBinding('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); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|