src/app/modules/core/directives/bodyscroll.directive.ts
AfterViewInit
OnDestroy
Selector | [appBodyScroll] |
Methods |
ngAfterViewInit |
ngAfterViewInit()
|
Returns :
void
|
ngOnDestroy |
ngOnDestroy()
|
Returns :
void
|
import {Directive, AfterViewInit, OnDestroy} from '@angular/core';
@Directive({
selector: '[appBodyScroll]'
})
export class BodyScrollDirective implements AfterViewInit, OnDestroy {
ngAfterViewInit(): void {
document.getElementsByTagName('body')[0].classList.add('o-y-hide');
}
ngOnDestroy(): void {
document.getElementsByTagName('body')[0].classList.remove('o-y-hide');
}
}