SlideShare a Scribd company logo
Angular ❤ CMS
a journey in dynamic content with @filipbech
@IMPACTdigitaldk
Filip
@filipbech
https://developers.google.com/experts/people/filip-bruun-bech-larsen
"
#weAreHiring #denmark #lisbon
https://www.facebook.com/groups/ngAarhus/
…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
Angular ❤️CMS
…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)
Angular ❤️CMS
Initial data and content
Angular ❤️CMS
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?
Angular ❤️CMS
Eeeewwwww
• even though it works - it feels terrible and wrong!
• and we need the parser at runtime
• so no AOT and bad perf
Angular ❤️CMS
Angular ❤️CMS
go see Pascals talk
tomorrow
Angular ❤️CMS
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…
Angular ❤️CMS
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
Angular ❤️CMS
**-route + generic
PageComponent
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
Angular ❤️CMS
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
Angular ❤️CMS
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…
The theory
Angular ❤️CMS
What components
should be available?
Angular ❤️CMS
we still can’t animate
page-transitions
cause its really not…
Custom RouterReuseStrategy
Angular ❤️CMS
Angular ❤️CMS
We have animations…
woohooooo
What about Rich-text
content from the CMS?
Angular ❤️CMS
Angular ❤️CMS
ng-bind-html
Angular ❤️CMS
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)
Can’t touch this (the DOM)
(no direct window, querySelector, localstorage)
Angular ❤️CMS
Angular ❤️CMS
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
Angular ❤️CMS
Angular ❤️CMS
We made it to nirvana
Thank you, this was:
“Angular ❤ CMS”
I’m @filipbech
code: https://github.com/filipbech/ng-dynamic-spa
@IMPACTdigitaldk
Office hours at 13.45
Angular ❤️CMS

More Related Content

PDF
Angular ❤️ CMS from #AngularUp
PPTX
Dynamic content with Angular
PPTX
SharePoint Fest Chicago 2017 - SharePoint Framework, Angular & Azure Functions
PPTX
SharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
PPTX
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
PPTX
SharePoint Saturday Utah 2018 - SharePoint Framework, Angular and Azure Funct...
PDF
Migrate PHP E-Commerce Site to Go
PPTX
State of angular ecosystem
Angular ❤️ CMS from #AngularUp
Dynamic content with Angular
SharePoint Fest Chicago 2017 - SharePoint Framework, Angular & Azure Functions
SharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
SharePoint Saturday Utah 2018 - SharePoint Framework, Angular and Azure Funct...
Migrate PHP E-Commerce Site to Go
State of angular ecosystem

What's hot (20)

PDF
Developing webapp using Polymer : is it ready for production? or not?
PDF
React-Native for multi-platform mobile applications @ Codemotion Rome 2017
PDF
Salvatore Laisa - Da Angular a React - Un viaggio inaspettato
PDF
The Thick Front-End
PDF
Getting Started with React Native (and should I use it at all?)
PPTX
Diving into SngularJS
PDF
So you think you can scale
PDF
Introduction to koyomi #appkoyomi
PPTX
PDF
FuelPHP presentation - PeoplePerHour workshop
PDF
Fast Web Applications with Go
PDF
Say hello world with angular 5
PDF
Why use Go for web development?
PPTX
Back to the ng2 Future
PPTX
Blogging for hackers (english)
PDF
EclipseCon-Europe 2013: Making the Eclipse IDE fun again
PDF
FuelPHP - a PHP HMVC Framework by silicongulf.com
PDF
Components vs Frameworks
PDF
A Gentle Introduction to GoOnRails
PPTX
Suggestatron
Developing webapp using Polymer : is it ready for production? or not?
React-Native for multi-platform mobile applications @ Codemotion Rome 2017
Salvatore Laisa - Da Angular a React - Un viaggio inaspettato
The Thick Front-End
Getting Started with React Native (and should I use it at all?)
Diving into SngularJS
So you think you can scale
Introduction to koyomi #appkoyomi
FuelPHP presentation - PeoplePerHour workshop
Fast Web Applications with Go
Say hello world with angular 5
Why use Go for web development?
Back to the ng2 Future
Blogging for hackers (english)
EclipseCon-Europe 2013: Making the Eclipse IDE fun again
FuelPHP - a PHP HMVC Framework by silicongulf.com
Components vs Frameworks
A Gentle Introduction to GoOnRails
Suggestatron
Ad

Similar to Angular ❤️CMS (20)

PDF
Building a dynamic SPA website with Angular
PPTX
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
PDF
The future of templating and frameworks
PDF
Whats next in templating
PDF
Whats next in templating
PPTX
European Collaboration Summit - SharePoint Framework Angular & Azure Functions
PPTX
North American Collaboration Summit 2018 - SharePoint Framework, Angular and ...
PPTX
North American Collaboration Summit 2018 - SharePoint Framework, Angular & Az...
PPTX
European SharePoint Conference 2017 - SharePoint Framework, Angular & Azure F...
PPTX
Open Apereo - Web components workshop
PDF
Angular 1.x reloaded: improve your app now! and get ready for 2.0
PPTX
Prototype4Production Presented at FOSSASIA2015 at Singapore
ODP
Joomla X Overview
PPTX
Future proofing design work with Web components
PDF
GWT Architectures and Lessons Learned (WJAX 2013)
PDF
Angular 2 - How we got here?
PDF
Building a blog with an Onion Architecture
PDF
Onion Architecture and the Blog
PDF
Desktop apps with node webkit
PPTX
Professionalizing the Front-end
Building a dynamic SPA website with Angular
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
The future of templating and frameworks
Whats next in templating
Whats next in templating
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 & Az...
European SharePoint Conference 2017 - SharePoint Framework, Angular & Azure F...
Open Apereo - Web components workshop
Angular 1.x reloaded: improve your app now! and get ready for 2.0
Prototype4Production Presented at FOSSASIA2015 at Singapore
Joomla X Overview
Future proofing design work with Web components
GWT Architectures and Lessons Learned (WJAX 2013)
Angular 2 - How we got here?
Building a blog with an Onion Architecture
Onion Architecture and the Blog
Desktop apps with node webkit
Professionalizing the Front-end
Ad

More from Filip Bruun Bech-Larsen (20)

PDF
Webcomponents from 0-100 - with Google's Lit
PDF
Webcomponents are your frameworks best friend
PDF
Content as a Service with Umbraco Headless
PDF
Frameworks and webcomponents
PDF
Whats next in clientside templating
PDF
Whats next in clientside templating
PDF
Future of the Web
PDF
Diversity at impact
PDF
The Future of the web
PDF
Frontend development of the (current) future
PDF
Commerce and the browser in 2017
PPTX
Frontend State of the union
PPTX
AngularJS best practices
PPTX
Frontend development of the (current) future
PPTX
Observables - the why, what & how
PPTX
Angular2 workshop
PPTX
Progressive Web Apps og Payment Request
PPTX
Spangulumbraco
PPTX
Web development post io2016
PPTX
Observables in angular2
Webcomponents from 0-100 - with Google's Lit
Webcomponents are your frameworks best friend
Content as a Service with Umbraco Headless
Frameworks and webcomponents
Whats next in clientside templating
Whats next in clientside templating
Future of the Web
Diversity at impact
The Future of the web
Frontend development of the (current) future
Commerce and the browser in 2017
Frontend State of the union
AngularJS best practices
Frontend development of the (current) future
Observables - the why, what & how
Angular2 workshop
Progressive Web Apps og Payment Request
Spangulumbraco
Web development post io2016
Observables in angular2

Recently uploaded (20)

PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
Big Data Technologies - Introduction.pptx
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
Cloud computing and distributed systems.
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
KodekX | Application Modernization Development
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Encapsulation theory and applications.pdf
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
20250228 LYD VKU AI Blended-Learning.pptx
Encapsulation_ Review paper, used for researhc scholars
Big Data Technologies - Introduction.pptx
Dropbox Q2 2025 Financial Results & Investor Presentation
Cloud computing and distributed systems.
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
KodekX | Application Modernization Development
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Encapsulation theory and applications.pdf
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Review of recent advances in non-invasive hemoglobin estimation
The Rise and Fall of 3GPP – Time for a Sabbatical?
Spectral efficient network and resource selection model in 5G networks
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Building Integrated photovoltaic BIPV_UPV.pdf
Electronic commerce courselecture one. Pdf
Network Security Unit 5.pdf for BCA BBA.
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx

Angular ❤️CMS