Is there any equivalent of window.onload event in Angular?
I want to fade out and remove my preloader but only after all resources like images are loaded. Since $viewConteneLoaded indicates only html insertion into view (i am using ngRotue) listening to it is not sufficient.
I would like to capture window.onload event, but don't know how to do it properly and what is the best-practice for doing it in Angular, so that digest would fire.
Write the following in the component file:
import { HostListener } from '@angular/core';
...
@HostListener('window:load')
onLoad() {
console.log('is window:load');
}
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With