mirror of
https://github.com/dotnetcore/Util.git
synced 2026-10-25 17:09:48 +08:00
32 lines
841 B
TypeScript
32 lines
841 B
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { Router, NavigationEnd } from '@angular/router';
|
|
import { filter } from 'rxjs/operators';
|
|
import { TitleService } from '@delon/theme';
|
|
import { NzModalService } from 'ng-zorro-antd';
|
|
|
|
/**
|
|
* 应用根组件
|
|
*/
|
|
@Component( {
|
|
selector: 'app',
|
|
template: `<router-outlet></router-outlet>`,
|
|
} )
|
|
export class AppComponent implements OnInit {
|
|
/**
|
|
* 初始化
|
|
*/
|
|
constructor( private router: Router, private titleSrv: TitleService, private modalSrv: NzModalService ) {
|
|
}
|
|
|
|
/**
|
|
* 初始化
|
|
*/
|
|
ngOnInit() {
|
|
this.router.events
|
|
.pipe( filter( evt => evt instanceof NavigationEnd ) )
|
|
.subscribe( () => {
|
|
this.titleSrv.setTitle();
|
|
this.modalSrv.closeAll();
|
|
} );
|
|
}
|
|
} |