Timely matter: when does Angular execute your code?
summary
Live demo code shows exact execution order using a custom logger and real routes and resolvers: ngOnChanges before ngOnInit when components have inputs, constructors and injected services run before lifecycle hooks, and nested guards hoisted before parent resolvers can reorder expected guard/resolver sequences. The talk proves APP_INITIALIZER runs before bootstrap component and platform initializers run even earlier. A built beforeunload handler works but breaks bfcache in some browsers, so early initialization increases startup latency and must be balanced against performance.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 1:03Talk overview
- 2:48Real-world use case
- 3:51Lifecycle hooks
- 6:44Code before lifecycle hooks
- 8:29Code before instantiation
- 11:18Injection tokens for early execution
- 13:48Platform initializer
- 15:58Code after user interaction
- 17:20Page unload events
- 19:07Key takeaways
- 20:12Closing remarks
related talks
32mImproving Startup Performance with Lazy Loading in Angular
33mPerceived faster Angular applications
28mAccelerating Angular
34mHigh-Performance Applications with Angular
34mImproving Start-up Performance with Lazy Loading in Angular 2
21mPreload Strategies: Step in Time, Step in Time!
31mAngular Performance: Your App at the Speed of Light
44mThe Future of Angular: Faster, Lighter, Stronger
