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
Advancing into new areas with Angular Elements ...
Search
Manfred Steyer
PRO
September 25, 2019
Programming
0
410
Advancing into new areas with Angular Elements and Ivy @BASTA 2019 in Mainz, Germany
Examples:
https://github.com/manfredsteyer/basta_2019_ivy_elements
Manfred Steyer
PRO
September 25, 2019
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
22
Reactivity, Reimagined: Angular Signals at Every Layer
manfredsteyer
PRO
0
50
Angular Architecture Workshop @AngularDays in Berlin 2025
manfredsteyer
PRO
0
35
Migration to Signals, Resource API, and NgRx Signal Store
manfredsteyer
PRO
0
120
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
組込みだけじゃない!TinyGo で始める無料クラウド開発入門
otakakot
2
380
なぜGoのジェネリクスはこの形なのか? - Featherweight Goが明かす設計の核心
qualiarts
0
260
Building, Deploying, and Monitoring Ruby Web Applications with Falcon (Kaigi on Rails 2025)
ioquatix
4
2.5k
Domain-centric? Why Hexagonal, Onion, and Clean Architecture Are Answers to the Wrong Question
olivergierke
3
970
monorepo の Go テストをはやくした〜い!~最小の依存解決への道のり~ / faster-testing-of-monorepos
convto
2
550
社会人になっても趣味開発を続けたい! / traPavilion
mazrean
1
100
チームの境界をブチ抜いていけ
tokai235
0
230
開発組織の戦略的な役割と 設計スキル向上の効果
masuda220
PRO
9
1.6k
Pythonに漸進的に型をつける
nealle
1
130
デミカツ切り抜きで面倒くさいことはPythonにやらせよう
aokswork3
0
260
Developer Joy - The New Paradigm
hollycummins
1
370
SODA - FACT BOOK(JP)
sodainc
1
8.8k
Featured
See All Featured
Leading Effective Engineering Teams in the AI Era
addyosmani
7
630
Rebuilding a faster, lazier Slack
samanthasiow
84
9.2k
Making the Leap to Tech Lead
cromwellryan
135
9.6k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
667
130k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
190
55k
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
Writing Fast Ruby
sferik
630
62k
The World Runs on Bad Software
bkeepers
PRO
72
11k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
55
3k
BBQ
matthewcrist
89
9.9k
Testing 201, or: Great Expectations
jmmastey
45
7.7k
Optimising Largest Contentful Paint
csswizardry
37
3.5k
Transcript
@ManfredSteyer Advancing into new areas with Angular Elements and Ivy
Manfred Steyer SOFTWAREarchitekt.at ManfredSteyer
@ManfredSteyer
@ManfredSteyer [Igor Minar, Angular Connect 2018 Keynote]
@ManfredSteyer
@ManfredSteyer Angular Elements
@ManfredSteyer Web Components: Framework independent components
@ManfredSteyer Custom Elements: Framework independent components
@ManfredSteyer Possibilities Component Libraries Enriching existing Apps CMS- Integration Dynamic
Loading
@ManfredSteyer Contents 1) Basics 2) Lazy loading elements 3) External
elements 4) Dealing with dependencies 5) Angular Ivy
@ManfredSteyer About me … • Manfred Steyer SOFTWAREarchitekt.at • Angular
Trainings and Consultancy • Google Developer Expert (GDE) • Angular Trusted Collaborator Page ▪ 10 Manfred Steyer Public: Frankfurt, Munich, Vienna In-House: Everywhere in Europe http://www.softwarearchitekt.at/workshops
@ManfredSteyer 1) Basics
@ManfredSteyer Angular Elements Wrap Angular Components Expose Custom Elements
@ManfredSteyer Angular Elements @NgModule({ imports: [BrowserModule], declarations: [DateComponent], entryComponents: [DateComponent]
}) export class AppModule { }
@ManfredSteyer Angular Elements @NgModule({ imports: [BrowserModule], declarations: [DateComponent], entryComponents: [DateComponent]
}) export class AppModule { }
@ManfredSteyer Angular Elements @NgModule({ imports: [BrowserModule], declarations: [DateComponent], entryComponents: [DateComponent]
}) export class AppModule { constructor(private injector: Injector) { } }
@ManfredSteyer Angular Elements @NgModule({ imports: [BrowserModule], declarations: [DateComponent], entryComponents: [DateComponent]
}) export class AppModule { constructor(private injector: Injector) { const DateElement = createCustomElement( DateComponent, { injector: this.injector }); customElements.define('date-picker', DateElement); } }
@ManfredSteyer Calling a Custom Element <date-picker></date-picker>
@ManfredSteyer Can be polyfilled down to IE11
@ManfredSteyer
@ManfredSteyer DEMO
@ManfredSteyer 2) Lazy Elements
@ManfredSteyer Lazy Loading Register module in angular.json Load with with
NgModuleFactoryLoader
@ManfredSteyer Register in angular.json "lazyModules": [ "[…]/lazy-dashboard-tile.module.ts" ],
@ManfredSteyer Lazy Loading @Injectable({ providedIn: 'root' }) export class LazyDashboardTileService
{ }
@ManfredSteyer Lazy Loading @Injectable({ providedIn: 'root' }) export class LazyDashboardTileService
{ constructor( private loader: NgModuleFactoryLoader, private injector: Injector ) {} }
@ManfredSteyer Lazy Loading @Injectable({ providedIn: 'root' }) export class LazyDashboardTileService
{ constructor( private loader: NgModuleFactoryLoader, private injector: Injector ) {} load(): Promise<void> { const path = '[…]lazy-dashboard-tile.module#LazyDashboardTileModule'; } }
@ManfredSteyer Lazy Loading @Injectable({ providedIn: 'root' }) export class LazyDashboardTileService
{ constructor( private loader: NgModuleFactoryLoader, private injector: Injector ) {} load(): Promise<void> { const path = '[…]lazy-dashboard-tile.module#LazyDashboardTileModule'; return this.loader.load(path).then(moduleFactory => { }); } }
@ManfredSteyer Lazy Loading @Injectable({ providedIn: 'root' }) export class LazyDashboardTileService
{ constructor( private loader: NgModuleFactoryLoader, private injector: Injector ) {} load(): Promise<void> { const path = '[…]lazy-dashboard-tile.module#LazyDashboardTileModule'; return this.loader.load(path).then(moduleFactory => { moduleFactory.create(this.injector); […] }); } }
@ManfredSteyer DEMO
@ManfredSteyer 3) External Elements aka Standalone Elements
@ManfredSteyer Project A Custom Element Custom Element Bundle Project B
@ManfredSteyer Register Custom Element when bootstrapping Compile application to self
contained bundle Load bundle into consumer 3 Steps
@ManfredSteyer Load into consumer const script = document.createElement('script'); script.src =
'assets/external-dashboard-tile.bundle.js'; document.body.appendChild(script);
@ManfredSteyer DEMO
@ManfredSteyer 6) Dealing with Dependencies
@ManfredSteyer Bundles Custom Element 1 Custom Element 2 Custom Element
3 Libraries: Angular, RxJS, … Libraries: Angular, RxJS, …
@ManfredSteyer Tree Shaking + Ivy (Angular 9.x) Custom Element 1
Custom Element 2 Custom Element 3
@BASTAcon & @ManfredSteyer [Brad Green, ngconf 2019 Keynote]
@ManfredSteyer DEMO
@ManfredSteyer Roadmap (details can change) • Ivy behind a flag
Angular 8 (Spring 2019) • Ivy by default • No breaking changes Angular 9 (Fall 2019)
@ManfredSteyer
@ManfredSteyer
@ManfredSteyer Where Ivy can help ✓ Widgets based on @angular/core,
@angular/common Libs like @angular/forms or @angular/router
@ManfredSteyer Sharing Libs Custom Element 1 Custom Element 2 Custom
Element 3 Libraries: Angular, RxJS, … UMD Drawbacks: Complexity, no isolation
@ManfredSteyer DEMO
@ManfredSteyer More on SOFTWAREarchitekt.at • Angular Elements (5 Parts) •
Web Components with Angular Ivy in 6 Steps • Architecture with Ivy (2 Parts so far) • A possible future without NgModules • Higher Order and Dynamic Components
@ManfredSteyer Summary Dynamically Adding External Elements Enhancing Existing Apps (e.
g. ASP.NET) Migration Path Ivy for UI-based Code ngx-build-plus: Sharing Dependencies
@ManfredSteyer Contact and Downloads [mail]
[email protected]
[web] SOFTWAREarchitekt.at [twitter] ManfredSteyer
d http://softwarearchitekt.at/workshops Slides & Examples