forked from tykayn/funky-framadate-front
scroll to top on route change
This commit is contained in:
parent
0c08e802c9
commit
74a928800e
@ -6,6 +6,7 @@ import { environment } from '../environments/environment';
|
||||
import { Theme } from './core/enums/theme.enum';
|
||||
import { LanguageService } from './core/services/language.service';
|
||||
import { ThemeService } from './core/services/theme.service';
|
||||
import { NavigationEnd, Router } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
@ -21,12 +22,20 @@ export class AppComponent implements OnInit, OnDestroy {
|
||||
private themeSubscription: Subscription;
|
||||
|
||||
constructor(
|
||||
private router: Router,
|
||||
private titleService: Title,
|
||||
private themeService: ThemeService,
|
||||
private languageService: LanguageService // private mockingService: MockingService
|
||||
) {}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.router.events.subscribe((evt) => {
|
||||
if (!(evt instanceof NavigationEnd)) {
|
||||
return;
|
||||
}
|
||||
window.scrollTo(0, 0);
|
||||
});
|
||||
|
||||
if (!environment.production) {
|
||||
this.appTitle += ' [DEV]';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user