SlideShare una empresa de Scribd logo
1 de 96
Descargar para leer sin conexión
Angular ❤ CMS
a journey in dynamic content with @filipbech
@IMPACTdigitaldk
Filip
@filipbech
"
https://developers.google.com/experts/people/filip-bruun-bech-larsen
#commerceExperience #weAreHiring #denmark #lisbon
…enough about me
let’s talk about using Angular with a CMS!
Angular ❤ CMS
a journey in dynamic content with @filipbech
@IMPACTdigitaldk
Let’s do like angular 1
NOPE
need to bootstrap a component
…but we have no root
component?
Bootstrapping multiple
components
• its a little harder to maintain state between applications
(but possible)
• the cms now needs to know what components are
angular-components, so they can all be bootstrapped.
(and their DOM-nodes if multiple of the same
component)
Initial data and content
NOPE
Because
• Root-components cannot have inputs
• Root-components cannot use content-projection
(transclusion)
https://github.com/angular/angular/issues/1858
How about a <body>-
component then?
Eeeewwwww
• even though it works - it feels terrible and wrong!
• and we need the parser at runtime
• so no AOT and bad perf
Elements
still no animated 

page-transitions…
We need a SPA
Single Page Application
• so we can also share state between routes
• animate route-changes
• and much more…
Demo-time
to heighten the suspense…
It starts with a router
…thats not very dynamic
We have too many routes with
no patterns
• “/“ is a frontpage
• “/om/os” is a content-page
• “/mejeri“ is a category-page
• “/mejeri/ost“ is a sub-category-page
• “/ost-i-skiver-mild-13-cheasy-200-g” is a product-page
So I talked to the Angular team…
…let the CMS
output route-config
Two issues with that approach
• Need to build and invalidate the bundle’s cache every
time an editor makes a change
• Users get stuck on the route-config they get at first load
One route to rule them all
Get the data in a resolve
PageResolve is just a class with resolve(route)-method on it
In angularJS we could use templateFactory and
select a template based on the api-response
But we cannot do that in Angular (2+), because 

there is no template-parser at runtime
All possible
PageComponents with
individual *ngIf’s
Eeeewwwww
Even though all the *ngIfs in the template are AOT
compiled into something more acceptable…
It still seems wrong to have it in the template!
but (for now) it works…
until you navigate around

(nothing happens)
you’re not changing the route
just its options
(so: no new resolve, no new ngOnInit)
Refactoring
• Listen for route-changes and handle resolving data
manually
The problem cascades
• When we go from one product-detail-page to another
product-detail-page…
• Refactor init-logic into ngOnChanges
Then came rc4
ComponentFactoryResolver adds beauty
and power to generic components…
What components
are available?
we still can’t animate
page-transitions
cause its really not…
Custom
RouterReuseStrategy
We have animations…
woohooooo
What about Rich-text
content from the CMS?
ng-bind-html
Perfect, except for links
the router doesn’t “hijack”
a[href]-clicks like uiRouter
enter the [href] directive
NOPE
@Hostlistener =>
router.go()
* in reality it’s a little more complicated…
Sweeeet
all we ever wanted
Without all the ugly
Flexibility
real routes => getting data in resolve + animations
Rich Text
Same approach for the
dynamic content spots
* we add another directive so we can repeat via *ngForOf
AOT
#justWorks
Server Side Rendering
SEO, social previews and 

faster perceived load-times
Seems hard to wrap your
head around universal
The idea
• server.module and a client.module
• they both import the app.module
• server and client module then replaces the
dependencies that are different with appropriate
environment-versions (eg. xhr or node-fetch, DOM or
virtual-dom)
• the cli can pretty much do it for you
Can’t touch this (the DOM)
(no direct window, querySelector, localstorage)
Maintaining state
we want to maintain state, so we don’t re-do all fetches
and calculations when the client boots up
StateTransfer Service
@angular/platform-server
CACHING OF SSR
can’t work with personalisation
3 strategies
at client
bootstrap
at 1st user
interaction
no SSR
enter no-ssr directive
We made it
Packaged up on npm as
@impactdk/ngx-routing-utils
Thank you, this was:
“Angular ❤ CMS”
I’m @filipbech
@IMPACTdigitaldk
@impactdk/ngx-routing-utils
Code-snippets made with carbon
Angular ❤️ CMS from #AngularUp

Más contenido relacionado

La actualidad más candente

The Thick Front-End
The Thick Front-EndThe Thick Front-End
The Thick Front-End
Jeff Dickey
 
Python to go
Python to goPython to go
Python to go
Weng Wei
 

La actualidad más candente (20)

Fast Web Applications with Go
Fast Web Applications with Go Fast Web Applications with Go
Fast Web Applications with Go
 
Why use Go for web development?
Why use Go for web development?Why use Go for web development?
Why use Go for web development?
 
Developing webapp using Polymer : is it ready for production? or not?
Developing webapp using Polymer : is it ready for production? or not?Developing webapp using Polymer : is it ready for production? or not?
Developing webapp using Polymer : is it ready for production? or not?
 
Getting started with Angular CLI
Getting started with Angular CLIGetting started with Angular CLI
Getting started with Angular CLI
 
Frontend as a first class citizen
Frontend as a first class citizenFrontend as a first class citizen
Frontend as a first class citizen
 
Getting Started with React Native (and should I use it at all?)
Getting Started with React Native (and should I use it at all?)Getting Started with React Native (and should I use it at all?)
Getting Started with React Native (and should I use it at all?)
 
The Thick Front-End
The Thick Front-EndThe Thick Front-End
The Thick Front-End
 
State of angular ecosystem
State of angular ecosystemState of angular ecosystem
State of angular ecosystem
 
Introduction to koyomi #appkoyomi
Introduction to koyomi #appkoyomiIntroduction to koyomi #appkoyomi
Introduction to koyomi #appkoyomi
 
Rails Vs CakePHP
Rails Vs CakePHPRails Vs CakePHP
Rails Vs CakePHP
 
FuelPHP presentation - PeoplePerHour workshop
FuelPHP presentation - PeoplePerHour workshopFuelPHP presentation - PeoplePerHour workshop
FuelPHP presentation - PeoplePerHour workshop
 
FuelPHP
FuelPHPFuelPHP
FuelPHP
 
Python to go
Python to goPython to go
Python to go
 
Diving into SngularJS
Diving into SngularJSDiving into SngularJS
Diving into SngularJS
 
The Tale of 2 CLIs - Ember-cli and Angular-cli
The Tale of 2 CLIs - Ember-cli and Angular-cliThe Tale of 2 CLIs - Ember-cli and Angular-cli
The Tale of 2 CLIs - Ember-cli and Angular-cli
 
FuelPHP - a PHP HMVC Framework by silicongulf.com
FuelPHP - a PHP HMVC Framework by silicongulf.comFuelPHP - a PHP HMVC Framework by silicongulf.com
FuelPHP - a PHP HMVC Framework by silicongulf.com
 
Salvatore Laisa - Da Angular a React - Un viaggio inaspettato
Salvatore Laisa - Da Angular a React - Un viaggio inaspettatoSalvatore Laisa - Da Angular a React - Un viaggio inaspettato
Salvatore Laisa - Da Angular a React - Un viaggio inaspettato
 
React-Native for multi-platform mobile applications @ Codemotion Rome 2017
React-Native for multi-platform mobile applications @ Codemotion Rome 2017React-Native for multi-platform mobile applications @ Codemotion Rome 2017
React-Native for multi-platform mobile applications @ Codemotion Rome 2017
 
Back to the ng2 Future
Back to the ng2 FutureBack to the ng2 Future
Back to the ng2 Future
 
So you think you can scale
So you think you can scaleSo you think you can scale
So you think you can scale
 

Similar a Angular ❤️ CMS from #AngularUp

SharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
SharePoint Fest DC - SharePoint Framework, Angular and Azure FunctionsSharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
SharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
Sébastien Levert
 
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
Sébastien Levert
 
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
Sébastien Levert
 
European Collaboration Summit - SharePoint Framework Angular & Azure Functions
European Collaboration Summit - SharePoint Framework Angular & Azure FunctionsEuropean Collaboration Summit - SharePoint Framework Angular & Azure Functions
European Collaboration Summit - SharePoint Framework Angular & Azure Functions
Sébastien Levert
 
North American Collaboration Summit 2018 - SharePoint Framework, Angular and ...
North American Collaboration Summit 2018 - SharePoint Framework, Angular and ...North American Collaboration Summit 2018 - SharePoint Framework, Angular and ...
North American Collaboration Summit 2018 - SharePoint Framework, Angular and ...
Sébastien Levert
 
North American Collaboration Summit 2018 - SharePoint Framework, Angular & Az...
North American Collaboration Summit 2018 - SharePoint Framework, Angular & Az...North American Collaboration Summit 2018 - SharePoint Framework, Angular & Az...
North American Collaboration Summit 2018 - SharePoint Framework, Angular & Az...
Sébastien Levert
 
Future proofing design work with Web components
Future proofing design work with Web componentsFuture proofing design work with Web components
Future proofing design work with Web components
btopro
 
European SharePoint Conference 2017 - SharePoint Framework, Angular & Azure F...
European SharePoint Conference 2017 - SharePoint Framework, Angular & Azure F...European SharePoint Conference 2017 - SharePoint Framework, Angular & Azure F...
European SharePoint Conference 2017 - SharePoint Framework, Angular & Azure F...
Sébastien Levert
 

Similar a Angular ❤️ CMS from #AngularUp (20)

SharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
SharePoint Fest DC - SharePoint Framework, Angular and Azure FunctionsSharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
SharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
 
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
 
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
 
The future of templating and frameworks
The future of templating and frameworksThe future of templating and frameworks
The future of templating and frameworks
 
Whats next in templating
Whats next in templatingWhats next in templating
Whats next in templating
 
European Collaboration Summit - SharePoint Framework Angular & Azure Functions
European Collaboration Summit - SharePoint Framework Angular & Azure FunctionsEuropean Collaboration Summit - SharePoint Framework Angular & Azure Functions
European Collaboration Summit - SharePoint Framework Angular & Azure Functions
 
North American Collaboration Summit 2018 - SharePoint Framework, Angular and ...
North American Collaboration Summit 2018 - SharePoint Framework, Angular and ...North American Collaboration Summit 2018 - SharePoint Framework, Angular and ...
North American Collaboration Summit 2018 - SharePoint Framework, Angular and ...
 
North American Collaboration Summit 2018 - SharePoint Framework, Angular & Az...
North American Collaboration Summit 2018 - SharePoint Framework, Angular & Az...North American Collaboration Summit 2018 - SharePoint Framework, Angular & Az...
North American Collaboration Summit 2018 - SharePoint Framework, Angular & Az...
 
Whats next in templating
Whats next in templatingWhats next in templating
Whats next in templating
 
Open Apereo - Web components workshop
Open Apereo - Web components workshopOpen Apereo - Web components workshop
Open Apereo - Web components workshop
 
Future proofing design work with Web components
Future proofing design work with Web componentsFuture proofing design work with Web components
Future proofing design work with Web components
 
Prototype4Production Presented at FOSSASIA2015 at Singapore
Prototype4Production Presented at FOSSASIA2015 at SingaporePrototype4Production Presented at FOSSASIA2015 at Singapore
Prototype4Production Presented at FOSSASIA2015 at Singapore
 
European SharePoint Conference 2017 - SharePoint Framework, Angular & Azure F...
European SharePoint Conference 2017 - SharePoint Framework, Angular & Azure F...European SharePoint Conference 2017 - SharePoint Framework, Angular & Azure F...
European SharePoint Conference 2017 - SharePoint Framework, Angular & Azure F...
 
Svelte the future of frontend development
Svelte   the future of frontend developmentSvelte   the future of frontend development
Svelte the future of frontend development
 
GWT Architectures and Lessons Learned (WJAX 2013)
GWT Architectures and Lessons Learned (WJAX 2013)GWT Architectures and Lessons Learned (WJAX 2013)
GWT Architectures and Lessons Learned (WJAX 2013)
 
Untangling spring week11
Untangling spring week11Untangling spring week11
Untangling spring week11
 
Professionalizing the Front-end
Professionalizing the Front-endProfessionalizing the Front-end
Professionalizing the Front-end
 
PuppetConf 2014 Killer R10K Workflow With Notes
PuppetConf 2014 Killer R10K Workflow With NotesPuppetConf 2014 Killer R10K Workflow With Notes
PuppetConf 2014 Killer R10K Workflow With Notes
 
Building a blog with an Onion Architecture
Building a blog with an Onion ArchitectureBuilding a blog with an Onion Architecture
Building a blog with an Onion Architecture
 
Onion Architecture and the Blog
Onion Architecture and the BlogOnion Architecture and the Blog
Onion Architecture and the Blog
 

Más de Filip Bruun Bech-Larsen

Más de Filip Bruun Bech-Larsen (20)

Webcomponents from 0-100 - with Google's Lit
Webcomponents from 0-100 - with Google's LitWebcomponents from 0-100 - with Google's Lit
Webcomponents from 0-100 - with Google's Lit
 
Webcomponents are your frameworks best friend
Webcomponents are your frameworks best friendWebcomponents are your frameworks best friend
Webcomponents are your frameworks best friend
 
Content as a Service with Umbraco Headless
Content as a Service with Umbraco HeadlessContent as a Service with Umbraco Headless
Content as a Service with Umbraco Headless
 
Frameworks and webcomponents
Frameworks and webcomponentsFrameworks and webcomponents
Frameworks and webcomponents
 
Whats next in clientside templating
Whats next in clientside templatingWhats next in clientside templating
Whats next in clientside templating
 
Whats next in clientside templating
Whats next in clientside templatingWhats next in clientside templating
Whats next in clientside templating
 
Future of the Web
Future of the WebFuture of the Web
Future of the Web
 
Diversity at impact
Diversity at impactDiversity at impact
Diversity at impact
 
The Future of the web
The Future of the webThe Future of the web
The Future of the web
 
Frontend development of the (current) future
Frontend development of the (current) futureFrontend development of the (current) future
Frontend development of the (current) future
 
Commerce and the browser in 2017
Commerce and the browser in 2017Commerce and the browser in 2017
Commerce and the browser in 2017
 
Frontend State of the union
Frontend State of the unionFrontend State of the union
Frontend State of the union
 
AngularJS best practices
AngularJS best practicesAngularJS best practices
AngularJS best practices
 
Frontend development of the (current) future
Frontend development of the (current) futureFrontend development of the (current) future
Frontend development of the (current) future
 
Observables - the why, what & how
Observables - the why, what & howObservables - the why, what & how
Observables - the why, what & how
 
Angular2 workshop
Angular2 workshopAngular2 workshop
Angular2 workshop
 
Progressive Web Apps og Payment Request
Progressive Web Apps og Payment RequestProgressive Web Apps og Payment Request
Progressive Web Apps og Payment Request
 
Spangulumbraco
SpangulumbracoSpangulumbraco
Spangulumbraco
 
Web development post io2016
Web development post io2016Web development post io2016
Web development post io2016
 
Observables in angular2
Observables in angular2Observables in angular2
Observables in angular2
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 

Último (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 

Angular ❤️ CMS from #AngularUp