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
Web Components with Angular: Beyond the basics
Search
Manfred Steyer
PRO
March 22, 2019
Programming
430
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Web Components with Angular: Beyond the basics
Manfred Steyer
PRO
March 22, 2019
More Decks by Manfred Steyer
See All by Manfred Steyer
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
0
110
Generative UI & AI-Assistants for Your Angular Solutions
manfredsteyer
PRO
0
82
Nostalgia Meets Technology: Super Mario with TypeScript
manfredsteyer
PRO
0
140
Signal Forms: Details & Live Coding @enterJS 2026 in Mannheim
manfredsteyer
PRO
0
210
Strategic Design in the Frontend: Moduliths & Micro Frontends @DDDEurope
manfredsteyer
PRO
0
140
Agentic UI
manfredsteyer
PRO
0
220
Signal Forms: Beyond the Basics @ngBaguette 2026 in Paris
manfredsteyer
PRO
0
280
Agentic UI beyond Chats Architecture Patterns & Open Standards @ngMunich 05/2026
manfredsteyer
PRO
0
240
Agentic AI in the Frontend: Architectures with Open Standards @iJS London 2026
manfredsteyer
PRO
0
170
Other Decks in Programming
See All in Programming
ECSアプリログをFireLensでコスト削減しようとしたけど諦めた話 in Fargate×Node.js
akihisaikeda
2
4.2k
Haskell/Servantを通してWebミドルウェアを捉え直す
pizzacat83
0
120
Creating Composable Callables in Contemporary C++
rollbear
0
190
SREの積み重ねがAI駆動開発のガードレールになった ― 7つの実践/SRE Guardrails The 7
tomoyakitaura
5
910
ローカルLLMでどこまでコードが書けるか -縮小版 / How much code can be written on a local LLM Shortened
kishida
2
170
SREは、MCPとSRE Agentをこう使え!
kazumax55
0
130
鹿野さんに聞く!『TypeScriptコードレシピ集』で磨く実践力
tonkotsuboy_com
4
980
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
230
AI時代のUIはどこへ行く?その2!
yusukebe
22
7.7k
Vue × Nuxt × Oxc どこまで使える?実運用の現在地
andpad
0
350
「正の参照」と 「負の導出」で組む ハーネスエンジニアリング
cottpan
1
110
例外の正しい扱い方 そのエラー try-catchして大丈夫?
jinwatanabe
0
320
Featured
See All Featured
The Web Performance Landscape in 2024 [PerfNow 2024]
tammyeverts
12
1.2k
The B2B funnel & how to create a winning content strategy
katarinadahlin
PRO
1
410
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.3k
[SF Ruby Conf 2025] Rails X
palkan
2
1.1k
Leo the Paperboy
mayatellez
7
1.9k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
760
Breaking role norms: Why Content Design is so much more than writing copy - Taylor Woolridge
uxyall
0
340
Designing for Timeless Needs
cassininazir
1
270
Designing for Performance
lara
611
70k
Testing 201, or: Great Expectations
jmmastey
46
8.2k
Design in an AI World
tapps
1
260
Transcript
@ManfredSteyer Web Components with Angular: Beyond the basics Manfred Steyer
SOFTWAREarchitekt.at ManfredSteyer
@ManfredSteyer About me … • Manfred Steyer SOFTWAREarchitekt.at • Angular
Trainings and Consultancy • Google Developer Expert (GDE) • Angular Trusted Collaborator Page ▪ 2 Manfred Steyer Public: Vienna, Munich, Frankfurt In-House: Everywhere in Europe http://www.softwarearchitekt.at/workshops
@ManfredSteyer Contents • Motivation & Angular Elements 101 • Polyfills
• Dynamic & Lazy elements • External elements • Dealing with dependencies • Excluding Zone.js
@ManfredSteyer Motivation
@ManfredSteyer Web Components: Framework independent components
@ManfredSteyer Standards Templates HTML Imports Custom Elements Shadow DOM
@ManfredSteyer Some Possibilities … Widget Libraries CMS Integration Enriching existing
Apps Migrating Legacy Apps
@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 CUSTOM_ELEMENTS_SCHEMA @NgModule({ […], schemas: [ CUSTOM_ELEMENTS_SCHEMA ] }) export
class MyModule {}
@ManfredSteyer DEMO
@ManfredSteyer Polyfills
@ManfredSteyer Distribution
@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 a we downlevel to ES5
@ManfredSteyer DEMO
@ManfredSteyer Dynamic and Lazy Elements
@ManfredSteyer Adding Custom Elements dynamically const tile = document.createElement('dashboard-tile');
@ManfredSteyer Adding Custom Elements dynamically const tile = document.createElement('dashboard-tile‘); tile['prop']
= 123; tile.setAttribute('class', 'col-lg-4 col-md-3 col-sm-2') tile.addEventListener([…])
@ManfredSteyer Adding Custom Elements dynamically const tile = document.createElement('dashboard-tile‘); tile['prop']
= 123; tile.setAttribute('class', 'col-lg-4 col-md-3 col-sm-2') tile.addEventListener([…]) content.appendChild(tile);
@ManfredSteyer Lazy Loading Register module in angular.json Load with with
NgModuleFactoryLoader
@ManfredSteyer Register in angular.json "lazyModules": [ "[…]/lazy-dashboard-tile.module.ts" ],
@ManfredSteyer Register in angular.json @Injectable({ providedIn: 'root' }) export class
LazyDashboardTileService { }
@ManfredSteyer Register in angular.json @Injectable({ providedIn: 'root' }) export class
LazyDashboardTileService { constructor( private loader: NgModuleFactoryLoader, private injector: Injector ) {} }
@ManfredSteyer Register in angular.json @Injectable({ providedIn: 'root' }) export class
LazyDashboardTileService { constructor( private loader: NgModuleFactoryLoader, private injector: Injector ) {} load(): Promise<void> { return this.loader.load(path).then(moduleFactory => { }); } }
@ManfredSteyer Register in angular.json @Injectable({ providedIn: 'root' }) export class
LazyDashboardTileService { constructor( private loader: NgModuleFactoryLoader, private injector: Injector ) {} load(): Promise<void> { return this.loader.load(path).then(moduleFactory => { moduleFactory.create(this.injector); […] }); } }
@ManfredSteyer DEMO
@ManfredSteyer External 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 Register when bootstrapping @NgModule({ […] bootstrap: [] }) export
class AppModule { }
@ManfredSteyer Register when bootstrapping @NgModule({ […] bootstrap: [] }) export
class AppModule { constructor(private injector: Injector) { } ngDoBootstrap() { } }
@ManfredSteyer Register when bootstrapping @NgModule({ […] bootstrap: [], }) export
class AppModule { constructor(private injector: Injector) { } ngDoBootstrap() { const externalTileCE = createCustomElement( ExternalDashboardTileComponent, { injector: this.injector }); customElements.define('external-dashboard-tile', externalTileCE); } }
@ManfredSteyer Compile to self-contained bundle
@ManfredSteyer ngx-build-plus: --single-bundle
@ManfredSteyer Load into consumer const script = document.createElement('script'); script.src =
'assets/external-dashboard-tile.bundle.js'; document.body.appendChild(script);
@ManfredSteyer DEMO
@ManfredSteyer 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 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 Drawbacks: Complexity, no isolation
@ManfredSteyer DEMO
@ManfredSteyer Excluding Zone.js
@ManfredSteyer How to exclude it? platformBrowserDynamic().bootstrapModule(AppModule, {ngZone: 'noop'})
@ManfredSteyer Consequences • Manual Change Detection • Change Detection via
Observables
@ManfredSteyer DEMO
@ManfredSteyer Summary Polyfills Adding dynamically Lazy loading Compiling and loading
external elements Dependencies Zone.js
@ManfredSteyer Contact and Downloads [mail]
[email protected]
[web] SOFTWAREarchitekt.at [twitter] ManfredSteyer
d Slides & Examples Public and In-House http://www.softwarearchitekt.at/workshops