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
Lazy Loading und Preloading mit Angular, Präse...
Search
Manfred Steyer
PRO
November 26, 2016
Programming
0
250
Lazy Loading und Preloading mit Angular, Präsentation von ngGraz, November 2016
Manfred Steyer
PRO
November 26, 2016
Tweet
Share
More Decks by Manfred Steyer
See All by Manfred Steyer
Rethinking Angular: The Future with Signals and the New Resource API @iJS Munich 2025
manfredsteyer
PRO
0
18
Reactivity, Reimagined: Angular Signals at Every Layer
manfredsteyer
PRO
0
47
Angular Architecture Workshop @AngularDays in Berlin 2025
manfredsteyer
PRO
0
30
Migration to Signals, Resource API, and NgRx Signal Store
manfredsteyer
PRO
0
110
Reactive Thinking with Signals and the Resource API
manfredsteyer
PRO
0
110
All About Angular's New Signal Forms
manfredsteyer
PRO
0
210
Your Perfect Project Setup for Angular @BASTA! 2025 in Mainz
manfredsteyer
PRO
0
220
Signals & Resource API in Angular: 3 Effective Rules for Your Architecture @BASTA 2025 in Mainz
manfredsteyer
PRO
0
140
Your Architecture as a Crime SceneForensic Analysis @BASTA! 2025 in Mainz, Germany
manfredsteyer
PRO
0
78
Other Decks in Programming
See All in Programming
『毎日の移動』を支えるGoバックエンド内製開発
yutautsugi
2
290
SODA - FACT BOOK(JP)
sodainc
1
8.7k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
460
Goで実践するドメイン駆動開発 AIと歩み始めた新規プロダクト開発の現在地
imkaoru
4
890
Android16 Migration Stories ~Building a Pattern for Android OS upgrades~
reoandroider
0
140
One Enishi After Another
snoozer05
PRO
0
160
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
240
コード生成なしでモック処理を実現!ovechkin-dm/mockioで学ぶメタプログラミング
qualiarts
0
260
Domain-centric? Why Hexagonal, Onion, and Clean Architecture Are Answers to the Wrong Question
olivergierke
3
970
Software Architecture
hschwentner
6
2.3k
What Spring Developers Should Know About Jakarta EE
ivargrimstad
0
470
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
620
Featured
See All Featured
Imperfection Machines: The Place of Print at Facebook
scottboms
269
13k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
116
20k
Facilitating Awesome Meetings
lara
57
6.6k
Rails Girls Zürich Keynote
gr2m
95
14k
The Cost Of JavaScript in 2023
addyosmani
55
9.1k
The World Runs on Bad Software
bkeepers
PRO
72
11k
YesSQL, Process and Tooling at Scale
rocio
173
15k
We Have a Design System, Now What?
morganepeng
53
7.8k
Principles of Awesome APIs and How to Build Them.
keavy
127
17k
Producing Creativity
orderedlist
PRO
347
40k
BBQ
matthewcrist
89
9.9k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Transcript
Lazy Loading und Preloading mit Angular 2 Manfred Steyer
About me … • Manfred Steyer • SOFTWAREarchitekt.at • Trainer
& Consultant • Focus: Angular • Google Developer Expert Page 2 Manfred Steyer
Inhalt • Lazy Loading • Preloading • Nutzung von Shared
Modules Page 3
Lazy Loading Page 4
Modul-Struktur Page 5 AppModule … … … SharedModule Root
Module Feature Modules Shared Module
Root Module mit Lazy Loading Page 6 const APP_ROUTE_CONFIG:
Routes = [ { path: '', redirectTo: 'home', pathMatch: 'full' }, { path: 'home', component: HomeComponent }, { path: 'flights', loadChildren: './[…]flight-booking.module#FlightBookingModule' } ];
Routen für Feature Module Page 7 const FLUG_ROUTES =
[ { path: '', component: FlugBuchenComponent, […] }, […] }
Konfiguration von Webpack • angular2-router-loader • Splittet Bundle in mehrere
Teile Page 8
DEMO Page 9
Preloading Page 10
Idee • Eventuell später benötigte Module werden nach (!) Anwendungsstart
geladen • Wird das Modul später tatsächlich benötigt, steht es augenblicklich zur Verfügung Page 11
Preloading aktivieren Page 12 export const AppRoutesModule = RouterModule.forRoot(
ROUTE_CONFIG, { preloadingStrategy: PreloadAllModules });
DEMO Page 13
Lazy Loading und Shared Services Page 14
DEMO Page 15
Lazy Loading und Shared Modules Page 16 AppModule FlugModule
SharedModule includes includes (lazy) includes
Lazy Loading und Shared Modules Page 17 AppModule FlugModule
SharedModule includes includes (lazy) includes AuthService AuthService
Lösung Page 18 AppModule FlugModule SharedModule includes (inkl. Provider)
includes (lazy) includes (exkl. Provider) AuthService
Shared Module Page 19 @NgModule({ […], providers: [] })
export class SharedModule { }
Shared Module Page 20 @NgModule({ […], providers: [] })
export class SharedModule { static forRoot(): ModuleWithProviders { return { ngModule: SharedModule, providers: [AuthService, […]] } } }
DEMO Page 21
Zusammenfassung Page 22 Lazy Loading von Modulen webpack splittet
Bundle Preloading Strategy Shared Modules mit und ohne Provider
Kontakt [mail]
[email protected]
[blog] SOFTWAREarchitekt.at [twitter] ManfredSteyer