Back to All Events

Maria Korneeva

  • Holiday Inn Ghent Expo (map)

Timely matter: when does Angular execute your code?

Description

Who we are? Developers!

What do we want? To load data in our Angular application!

When do we want it? As soon as possible!

Many of us are familiar with component lifecycle hooks such as onInit or afterViewInit. What are other hooks that Angular gives us to load our data or to execute some code? In my talk I'm going to investigate it and put it on a time scale - from bootstrapping function to APP_INITIALIZER and resolvers. We will learn what code is executed first and last, creating a time perspective of an Angular application.

Key takeaways

  1. Mind caching of routing components for your lifecycle hooks

  2. Be aware that the guards of the nested routes are executed before the resolver

  3. Use APP_INITIALIZER to initialise your service during app bootstrapping (if necessary)

  4. Take care of unsaved changes with an onbeforeunload event listener, but don't forget about the back/forward cache

  5. Be careful with executing too much initialisation logic as it affects your core web vitals

About Maria

Maria Korneeva

Maria is a Frontend Technology Lead and a Google Developer Expert with focus on Angular. She writes for ng-conf, speaks at tech meetups and co-organizes NG-DE conference. In her tweets and articles Maria likes to share her learnings from everyday coding. Fun fact: she illustrates her stories herself because she likes drawing.

Learn more about Maria at:

Earlier Event: March 24
Rares Matei & Miroslav Jonaš
Later Event: March 24
Jeff Whelpley