Add OnInit to components to scroll to top on initialization
Updated Privacy, Team, Terms, and About components to implement OnInit. Each component now calls the `scrollToTop` method of the `ScrollService` in the `ngOnInit` lifecycle to ensure the page starts at the top when initialized.
This commit is contained in:
parent
b4d78690d9
commit
d4e231f67b
|
|
@ -1,4 +1,4 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {ScrollService} from '../scroll/scroll.service';
|
import {ScrollService} from '../scroll/scroll.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
@ -7,7 +7,11 @@ import {ScrollService} from '../scroll/scroll.service';
|
||||||
templateUrl: './about.component.html',
|
templateUrl: './about.component.html',
|
||||||
styleUrl: './about.component.scss'
|
styleUrl: './about.component.scss'
|
||||||
})
|
})
|
||||||
export class AboutComponent {
|
export class AboutComponent implements OnInit {
|
||||||
constructor(public scrollService: ScrollService) {
|
constructor(public scrollService: ScrollService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.scrollService.scrollToTop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {ScrollService} from '../scroll/scroll.service';
|
import {ScrollService} from '../scroll/scroll.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
@ -7,8 +7,12 @@ import {ScrollService} from '../scroll/scroll.service';
|
||||||
templateUrl: './privacy.component.html',
|
templateUrl: './privacy.component.html',
|
||||||
styleUrl: './privacy.component.scss'
|
styleUrl: './privacy.component.scss'
|
||||||
})
|
})
|
||||||
export class PrivacyComponent {
|
export class PrivacyComponent implements OnInit {
|
||||||
constructor(public scrollService: ScrollService) {
|
constructor(public scrollService: ScrollService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.scrollService.scrollToTop();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {ScrollService} from '../scroll/scroll.service';
|
import {ScrollService} from '../scroll/scroll.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
@ -7,7 +7,11 @@ import {ScrollService} from '../scroll/scroll.service';
|
||||||
templateUrl: './team.component.html',
|
templateUrl: './team.component.html',
|
||||||
styleUrl: './team.component.scss'
|
styleUrl: './team.component.scss'
|
||||||
})
|
})
|
||||||
export class TeamComponent {
|
export class TeamComponent implements OnInit {
|
||||||
constructor(public scrollService: ScrollService) {
|
constructor(public scrollService: ScrollService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.scrollService.scrollToTop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import {Component} from '@angular/core';
|
import {Component, OnInit} from '@angular/core';
|
||||||
import {ScrollService} from '../scroll/scroll.service';
|
import {ScrollService} from '../scroll/scroll.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
|
|
@ -7,8 +7,12 @@ import {ScrollService} from '../scroll/scroll.service';
|
||||||
templateUrl: './terms.component.html',
|
templateUrl: './terms.component.html',
|
||||||
styleUrl: './terms.component.scss'
|
styleUrl: './terms.component.scss'
|
||||||
})
|
})
|
||||||
export class TermsComponent {
|
export class TermsComponent implements OnInit {
|
||||||
constructor(public scrollService: ScrollService) {
|
constructor(public scrollService: ScrollService) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
this.scrollService.scrollToTop();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user