Angular: How to listen on window.onload event?

code đờ

In Angular (not AngularJS), how to listen on window.onload event?
(This is not a duplicate of window.onload in Angular, since that question is about AngularJS)

Alvin Saldanha

According to the Official documentation:

The load event fires when a given resource has loaded.

In this case the resource is the JavaScript file itself. So the onload event is fired long before your angular components are initialised.

You should be instead using OnInit or AfterViewInit angular lifecycle events based on what you are trying to do.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related