mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
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 { Theme } from './core/enums/theme.enum';
|
||||||
import { LanguageService } from './core/services/language.service';
|
import { LanguageService } from './core/services/language.service';
|
||||||
import { ThemeService } from './core/services/theme.service';
|
import { ThemeService } from './core/services/theme.service';
|
||||||
|
import { NavigationEnd, Router } from '@angular/router';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-root',
|
selector: 'app-root',
|
||||||
@ -21,12 +22,20 @@ export class AppComponent implements OnInit, OnDestroy {
|
|||||||
private themeSubscription: Subscription;
|
private themeSubscription: Subscription;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
|
private router: Router,
|
||||||
private titleService: Title,
|
private titleService: Title,
|
||||||
private themeService: ThemeService,
|
private themeService: ThemeService,
|
||||||
private languageService: LanguageService // private mockingService: MockingService
|
private languageService: LanguageService // private mockingService: MockingService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
this.router.events.subscribe((evt) => {
|
||||||
|
if (!(evt instanceof NavigationEnd)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
window.scrollTo(0, 0);
|
||||||
|
});
|
||||||
|
|
||||||
if (!environment.production) {
|
if (!environment.production) {
|
||||||
this.appTitle += ' [DEV]';
|
this.appTitle += ' [DEV]';
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user