Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Angular, Lazy Loading, ngVikings in Copenhagen,...
Search
Manfred Steyer
PRO
February 11, 2017
Programming
610
1
Share
Angular, Lazy Loading, ngVikings in Copenhagen, Feb 2017
Manfred Steyer
PRO
February 11, 2017
More Decks by Manfred Steyer
See All by Manfred Steyer
Agentic UI with Angular @ngAir April 2025
manfredsteyer
PRO
0
130
Migration to Signals, Signal Forms, Resource API, and NgRx Signal Store @Angular Days 03/2026 Munich
manfredsteyer
PRO
0
290
AI Assistants for YourAngular Solutions @Angular Graz, March 2026
manfredsteyer
PRO
0
180
AI Assistants for Your Angular Solutions @ngVienna March 2026
manfredsteyer
PRO
0
91
AI Assistants for Your Angular Solutions
manfredsteyer
PRO
0
190
Nostalgia Meets Technology: Super Mario with TypeScript
manfredsteyer
PRO
0
140
Full Cycle Reactivity in Angular: SignalStore mit Signal Forms und Resources
manfredsteyer
PRO
0
100
Premier Disciplin for Micro Frontends Multi Version/ Framework Scenarios @OOP 2026, Munic
manfredsteyer
PRO
0
270
Beyond the Basics: Signal Forms
manfredsteyer
PRO
0
180
Other Decks in Programming
See All in Programming
How We Benchmarked Quarkus: Patterns and anti-patterns
hollycummins
1
140
セグメントとターゲットを意識するプロポーザルの書き方 〜採択の鍵は、誰に刺すかを見極めるマーケティング戦略にある〜
m3m0r7
PRO
0
550
GNU Makeの使い方 / How to use GNU Make
kaityo256
PRO
16
5.6k
PHP で mp3 プレイヤーを実装しよう
m3m0r7
PRO
0
280
Kubernetes上でAgentを動かすための最新動向と押さえるべき概念まとめ
sotamaki0421
3
500
YJITとZJITにはイカなる違いがあるのか?
nakiym
0
220
PicoRuby for IoT: Connecting to the Cloud with MQTT
yuuu
2
560
AIベース静的検査器の偽陽性率を抑える工夫3選
orgachem
PRO
3
310
ルールルルルルRubyの中身の予備知識 ── RubyKaigiの前に予習しなイカ?
ydah
1
180
運転動画を検索可能にする〜Cosmos-Embed1とDatabricks Vector Searchで〜/cosmos-embed1-databricks-vector-search
studio_graph
0
130
VueエンジニアがReactを触って感じた_設計の違い
koukimiura
0
180
一度始めたらやめられない開発効率向上術 / Findy あなたのdotfilesを教えて!
k0kubun
4
3k
Featured
See All Featured
How To Stay Up To Date on Web Technology
chriscoyier
790
250k
Kristin Tynski - Automating Marketing Tasks With AI
techseoconnect
PRO
0
220
Thoughts on Productivity
jonyablonski
76
5.1k
The Straight Up "How To Draw Better" Workshop
denniskardys
239
140k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
1
3.5k
Become a Pro
speakerdeck
PRO
31
5.9k
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
450
Groundhog Day: Seeking Process in Gaming for Health
codingconduct
0
140
What’s in a name? Adding method to the madness
productmarketing
PRO
24
4k
Six Lessons from altMBA
skipperchong
29
4.2k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.2k
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
2
210
Transcript
Improving Start-up Performance with Lazy Loading in Angular 2 Manfred
Steyer SOFTWAREarchitekt.at ManfredSteyer
About me … • Manfred Steyer • SOFTWAREarchitekt.at • Trainer
& Consultant • Focus: Angular • Google Developer Expert (GDE) Page 2 Manfred Steyer
Contents • Lazy Loading • Preloading • Prevent Lazy Loading
• Shared Modules and Lazy Loading Page 3
Lazy Loading Page 4
Module Structure Page 5 AppModule … … … SharedModule
Root Module Feature Modules Shared Module
Lazy Loading Page 6 AppModule … … … SharedModule
Root Module Feature Modules Shared Module
Root Module with Lazy Loading Page 7 const APP_ROUTE_CONFIG:
Routes = [ { path: 'home', component: HomeComponent }, { path: 'flights', loadChildren: './[…]flight-booking.module#FlightBookingModule' } ];
Routes for Feature Module Page 8 const FLIGHT_ROUTES =
[ { path: '/bookings', component: FlightBookingComponent, […] }, […] } Url: /flights/bookings Triggers Lazy Loading
webpack configuration • angular2-router-loader • creates several chunks Page
9
DEMO Page 10
Preloading Page 11
Idea • Modules that might be needed later are loaded
after (!) the start of the application • When the module is actually needed, it is available immediately Page 12
Activating Preloading Page 13 const AppRoutesModule = RouterModule.forRoot( ROUTE_CONFIG,
{ preloadingStrategy: PreloadAllModules });
DEMO Page 14
Lazy Loading and Shared Modules Page 22
DEMO Page 23
Lazy Loading and Shared Modules Page 24 AppModule FlightModule
SharedModule includes includes (lazy) includes AuthService
Lazy Loading and Shared Modules Page 25 AppModule FlightModule
SharedModule includes includes (lazy) includes AuthService AuthService
Lazy Loading and Shared Modules Page 26 AppModule FlightModule
SharedModule includes includes (lazy) includes AuthService AuthService
Solution Page 27 AppModule FlightModule SharedModule includes (lazy) includes
CoreModule includes includes Only import CoreModule into AppModule! Global Providers like AuthService & Shell
DEMO
Huge CoreModule? Page 29 AppModule FlightModule SharedModule includes (lazy)
includes CoreModule includes includes
Solution (for Libraries) Page 30 AppModule FlightModule AuthModule includes
(lazy) CoreModule
Solution (for Libraries) Page 31 AppModule FlightModule AuthModule includes
(lazy) includes (with Services) CoreModule includes includes (without Services)
Auth Module Page 32 @NgModule({ […], providers: [] })
export class AuthModule { }
Auth Module Page 33 @NgModule({ […], providers: [] })
export class AuthModule { static forRoot(): ModuleWithProviders { return { ngModule: AuthModule, providers: [AuthService, […]] } } }
DEMO Page 34
Summary Page 35 Lazy Loading of Modules webpack splits
chunks Prevent Lazy Loading with Guards Preloading Strategy Use Core Module for global Services Shared Modules w/ and w/o Providers
Contact [mail]
[email protected]
[blog] SOFTWAREarchitekt.at [twitter] ManfredSteyer