Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Web Components with Angular: Workshop @MobileTe...
Search
Manfred Steyer
PRO
March 25, 2019
Programming
370
3
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Web Components with Angular: Workshop @MobileTechCon Munich 2019
Examples:
https://github.com/manfredsteyer/web-components
Manfred Steyer
PRO
March 25, 2019
More Decks by Manfred Steyer
See All by Manfred Steyer
Beyond Chatbots: Agentic UI with Open Standards @AGNTcon 2026 in Amsterdam
manfredsteyer
PRO
0
52
Next-Level Frontends: Agentic Web UIs Under the Hood
manfredsteyer
PRO
0
46
Agentic UI with Open Standards @ngGraz Sep 2026
manfredsteyer
PRO
0
72
Agentic UI with Open Standards @GDG Salzburg, Bgl & Prishtina
manfredsteyer
PRO
0
64
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
1
500
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
0
210
Nostalgia Meets Technology: Super Mario with TypeScript
manfredsteyer
PRO
0
300
Signal Forms: Details & Live Coding @enterJS 2026 in Mannheim
manfredsteyer
PRO
0
300
Strategic Design in the Frontend: Moduliths & Micro Frontends @DDDEurope
manfredsteyer
PRO
0
210
Other Decks in Programming
See All in Programming
LL言語やWebフレームワークのPostgreSQL対応 〜DBの機能がユーザーに届くまで〜
kentaroutakeda
1
150
Heart of Swift Concurrency
koher
0
820
新人はどこまで自力でやり、どこからAIに頼るべきか/エンジニア育成に向き合う_先輩たちの悩みと知見共有会
toppan_digital_dev
1
620
Java 27新機能 / Java 27 new features
kishida
2
140
AI × TiDD / 2026.09.05 Redmine 大阪
tokudiro
1
170
Kiroで創り、AgentCoreで繋ぐ!AWSで実践する「AI-DLC」から「AIエージェント統合」までの最新地図
licux
4
690
AGENTS.md Is Not Enough:Build Skills, Don't Download Them
lx_t
0
120
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
120
GraphRAGのKnowledge Graphを 直接!見る/View-GraphRAG's-KnowledgeGraph-directly!
tyumugi1113
1
330
技術的負債の返済は、AI時代の複利で効く投資 — 経営としての意思決定とその遂行
curekoshimizu
0
1.4k
How I Stole PSI from Android Studio - DroidKaigi2026
worker8
0
130
速習iPhone Duo対応
yuukiw00w
1
510
Featured
See All Featured
AI: The stuff that nobody shows you
jnunemaker
PRO
10
1k
Code Reviewing Like a Champion
maltzj
528
40k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
74
42k
The Cult of Friendly URLs
andyhume
79
7k
Context Engineering - Making Every Token Count
addyosmani
9
1.1k
Odyssey Design
rkendrick25
PRO
2
810
The untapped power of vector embeddings
frankvandijk
2
1.9k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.2k
Designing for Timeless Needs
cassininazir
1
480
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
700
SEO for Brand Visibility & Recognition
aleyda
0
4.7k
Utilizing Notion as your number one productivity tool
mfonobong
4
590
Transcript
@ManfredSteyer Angular Elements Workshop Manfred Steyer SOFTWAREarchitekt.at ManfredSteyer
@ManfredSteyer ✓ Commodore 64 ✓ 1982 ✓ ~ 1 MHz
✓ 64 KB RAM ✓ Disks with 170 KB
@ManfredSteyer Version with two cores ;-) Challenge: Resources!
@ManfredSteyer Long Time Maintain- ability Maintain + Extend for 10
+/- yrs
@ManfredSteyer There are milk products lasting longer than some JavaScript
frameworks
@ManfredSteyer About me… • Manfred Steyer • SOFTWAREarchitekt.at • Angular
Trainings and Consultancy • Google Developer Expert (GDE) • Trusted Collaborator for Angular Page ▪ 6 Manfred Steyer Public: München, Frankfurt, Wien In-House: everywhere http://www.softwarearchitekt.at
@ManfredSteyer Contents • Web Components • Using Web Components in
Angular • Web Components with Angular Elements • Lazy and External Web Components • Building Web Components • Zone-less Change Detection • Content Projection
@ManfredSteyer Web Components
@ManfredSteyer Framework independent Components
@ManfredSteyer Umbrella Term for several Standards
@ManfredSteyer Standards Templates HTML Imports Custom Elements Shadow DOM
@ManfredSteyer Templates Markup that is rendered but not displayed Can
be displayed when needed, e. g. within components <template><span class="number"></span> Records found</template>
@ManfredSteyer Custom Elements Custom HTML-Element, e. g. <date-picker> Behaves like
build-in ones Write once; consume with any framework
@ManfredSteyer Examples <slider min="0" max="100"> … <customer-selector selected="selected()"> … <my-micro-app
state="sharedState" message="handle(…)">…
@ManfredSteyer Shadow DOM Isolate CSS Parent cannot influence Component's layout
Component cannot influence Parent or Siblings
@ManfredSteyer Possibilities Widget Libraries Enriching existing Apps Migrating Legacy Apps
CMS Integration UI Integration/ Composition Micro Apps
@ManfredSteyer All this can be polyfilled down to IE11 (more
or less)
@ManfredSteyer Polyfill
@ManfredSteyer Selected Polyfills • webcomponents-loader.js • Loads Polyfills on demand
• Custom Elements • Shadom DOM • Templates • native-shim.js • Needed for browsers that DO support polyfills … • … as long as we downlevel to ES5
@ManfredSteyer API class HelloElement extends HTMLElement { […] }
@ManfredSteyer API class HelloElement extends HTMLElement { constructor() { super();
this.attachShadow({mode: 'open'}); this.shadowRoot.innerHTML = '<div>Hello World</div>'; } […] }
@ManfredSteyer API class HelloElement extends HTMLElement { constructor() { super();
this.attachShadow({mode: 'open'}); this.shadowRoot.innerHTML = '<div>Hello World</div>'; } […] } customElements.define('hello-world', HelloElement);
@ManfredSteyer Calling a Web Component <hello-world></hello-world>
@ManfredSteyer Using Properties class HelloElement extends HTMLElement { get name()
{ […] } set name(value: string) { … } constructor() { […] } […] }
@ManfredSteyer Using Properties <!-- Property Binding with Angular --> <hello-world
[name]="firstName"></hello-world> <hello-world [name]="'Max'"></hello-world> <!-- VanillaJS --> var elm = document.getElementById(…) elm['name'] = max;
@ManfredSteyer Using Attributes <hello-world name="Max"></hello-world> Not a property!!
@ManfredSteyer Component Callbacks & Co. • attributeChangedCallback(name, oldValue, newValue) •
static get observedAttributes • connectedCallback • disconnectedCallback • adoptedCallback
@ManfredSteyer DEMO
@ManfredSteyer Angular Elements
@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], bootstrap: [],
entryComponents: [DateComponent] }) export class AppModule { constructor(private injector: Injector) { const DateElement = createCustomElement( DateComponent, { injector: this.injector }); customElements.define('date-picker', DateElement); } }
@ManfredSteyer Angular (Elements) & Shadow DOM • Baked-in • Default:
Emulation • @Component({ encapsulation: ViewEncapsulation.Emulated }) • Shadow DOM (v0) • @Component({ encapsulation: ViewEncapsulation.Native }) • Shadow DOM (v1) • @Component({ encapsulation: ViewEncapsulation.ShadowDom }) • Can be turned off: • @Component({ encapsulation: ViewEncapsulation.None })
@ManfredSteyer DEMO
@ManfredSteyer Differential Serving
@ManfredSteyer All your users pay for IE 11! • Polyfills:
~ 150 KB • Even custom elements polyfills for browsers that DO support custom elements b/c of ES5 • ES5: Bigger, less optimized
@ManfredSteyer Differential Serving • Provide modern ES2015+ bundels w/o polyfills
• Provide legacy ES5 bundles w/ polyfills • Let browser decide which to load
@ManfredSteyer How can browser decide? <script src="legacy.js" nomodule></script> <script src="modern.js"
type="module"></script>
@ManfredSteyer Automation • Vue: --modern • Angular: ngx-build-modern • Soon:
Angular CLI 8
@ManfredSteyer DEMO
@ManfredSteyer Sharing Dependencies
@ManfredSteyer Bundles Custom Element 1 Custom Element 2 Custom Element
3 Libraries: Angular, RxJS, … Libraries: Angular, RxJS, …
@ManfredSteyer Tree Shaking + ngIvy (Angular 8.x?) Custom Element 1
Custom Element 2 Custom Element 3
@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 ngx-build-plus Drawbacks: Complexity, no isolation
@ManfredSteyer DEMO
@ManfredSteyer Zone-less Change Detection
@ManfredSteyer Why zone.js? • Used by Angular's changed detection •
Patches each browser event • Notifies Angular after each event handler
@ManfredSteyer Why not zone.js? • 127 KB (12 gzipped) •
Awkward to force consumers of our web components to load zone.js
@ManfredSteyer How to exclude it? platformBrowserDynamic().bootstrapModule(AppModule, {ngZone: 'noop'})
@ManfredSteyer Consequences • Manual Change Detection • Change Detection via
Observables
@ManfredSteyer DEMO
@ManfredSteyer Content Projection
@ManfredSteyer Panel
@ManfredSteyer Calling a Tab <my-tab title="Page 1"> Lorem ipsum, dolor
sit amet … <div slot="footer">Some extra info</div> </my-tab>
@ManfredSteyer Implementation <div id="tab"> <h2>{{title}}</h2> <div id="content"> <slot></slot> </div> </div>
@ManfredSteyer Implementation <div id="tab"> <h2>{{title}}</h2> <div id="content"> <slot></slot> <div class="small">
<slot name="footer"></slot> </div> </div> </div>
@ManfredSteyer Slot API • ShadowDOM v1 • ViewEncapsulation.ShadowDom
@ManfredSteyer DEMO
@ManfredSteyer Summary Polyfills and CUSTOM ELEMENTS_SCHEMA Directives for Two-Way-Binding Lazy
& External Web Components Build Strategies: Differential Serving Sharing Code Zone-less Slot API
@ManfredSteyer Contact and Downloads [mail]
[email protected]
[web] SOFTWAREarchitekt.at [twitter] ManfredSteyer
d Blog about this stuff