Commit 3a4b521c authored by Etienne LOUPIAS's avatar Etienne LOUPIAS
Browse files

feat(posts): restore window scroll service

parent 44f089f9
Pipeline #23360 passed with stage
in 5 minutes and 20 seconds
<div class="app-container">
<app-header></app-header>
<div class="app-body">
<div (scroll)="onScrollDown($event)" class="app-body">
<router-outlet></router-outlet>
<router-outlet name="print"></router-outlet>
<app-footer></app-footer>
......
......@@ -5,6 +5,7 @@ import { AuthService } from './services/auth.service';
import { RouterListenerService } from './services/routerListener.service';
import { UpdateService } from './services/update.service';
import { PrintService } from './shared/service/print.service';
import { WindowScrollService } from './shared/service/windowScroll.service';
@Component({
selector: 'app-root',
......@@ -18,6 +19,7 @@ export class AppComponent implements OnInit {
public printService: PrintService,
private authService: AuthService,
private profilService: ProfileService,
private windowScrollService: WindowScrollService,
private routerListener: RouterListenerService,
private updateService: UpdateService,
private router: Router
......@@ -50,4 +52,7 @@ export class AppComponent implements OnInit {
const vh = window.innerHeight * 0.01;
document.documentElement.style.setProperty('--vh', `${vh}px`);
}
public onScrollDown(event): void {
this.windowScrollService.scrollY.next(event);
}
}
import { Injectable } from '@angular/core';
import { BehaviorSubject } from 'rxjs';
@Injectable({
providedIn: 'root',
})
export class WindowScrollService {
scrollY = new BehaviorSubject(null);
scrollY$ = this.scrollY.asObservable();
constructor() {}
public updateScrollY(value: Event): void {
this.scrollY.next(value);
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment