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
#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
Angular ❤️ CMS from #AngularUp
…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 from #AngularUp
Initial data and content
Angular ❤️ CMS from #AngularUp
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 from #AngularUp
Eeeewwwww
• even though it works - it feels terrible and wrong!
• and we need the parser at runtime
• so no AOT and bad perf
Elements
Angular ❤️ CMS from #AngularUp
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 from #AngularUp
It starts with a router
Angular ❤️ CMS from #AngularUp
…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 from #AngularUp
Angular ❤️ CMS from #AngularUp
Get the data in a resolve
Angular ❤️ CMS from #AngularUp
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 from #AngularUp
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 from #AngularUp
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…
Angular ❤️ CMS from #AngularUp
What components
are available?
Angular ❤️ CMS from #AngularUp
Angular ❤️ CMS from #AngularUp
Angular ❤️ CMS from #AngularUp
we still can’t animate
page-transitions
cause its really not…
Custom
RouterReuseStrategy
Angular ❤️ CMS from #AngularUp
Angular ❤️ CMS from #AngularUp
We have animations…
woohooooo
What about Rich-text
content from the CMS?
Angular ❤️ CMS from #AngularUp
Angular ❤️ CMS from #AngularUp
ng-bind-html
Angular ❤️ CMS from #AngularUp
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
Angular ❤️ CMS from #AngularUp
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
Angular ❤️ CMS from #AngularUp
Angular ❤️ CMS from #AngularUp
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

More Related Content

PDF
Angular ❤️CMS
PPTX
Dynamic content with Angular
PDF
Building a dynamic SPA website with Angular
PDF
Migrate PHP E-Commerce Site to Go
PPTX
SharePoint Fest Chicago 2017 - SharePoint Framework, Angular & Azure Functions
PDF
Metaprogramming Go
PPTX
SharePoint Saturday Utah 2018 - SharePoint Framework, Angular and Azure Funct...
PPTX
Angular CLI : HelloWorld
Angular ❤️CMS
Dynamic content with Angular
Building a dynamic SPA website with Angular
Migrate PHP E-Commerce Site to Go
SharePoint Fest Chicago 2017 - SharePoint Framework, Angular & Azure Functions
Metaprogramming Go
SharePoint Saturday Utah 2018 - SharePoint Framework, Angular and Azure Funct...
Angular CLI : HelloWorld

What's hot (20)

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

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

PPTX
SharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
PPTX
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
PPTX
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
PDF
The future of templating and frameworks
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...
PDF
Whats next in templating
PPTX
Open Apereo - Web components workshop
PPTX
Future proofing design work with Web components
PPTX
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
PPTX
Prototype4Production Presented at FOSSASIA2015 at Singapore
PPTX
European SharePoint Conference 2017 - SharePoint Framework, Angular & Azure F...
PDF
Svelte the future of frontend development
PDF
GWT Architectures and Lessons Learned (WJAX 2013)
PPTX
Untangling spring week11
PPTX
Professionalizing the Front-end
PDF
PuppetConf 2014 Killer R10K Workflow With Notes
PDF
Building a blog with an Onion Architecture
SharePoint Fest DC - SharePoint Framework, Angular and Azure Functions
SharePoint Saturday Vancouver - SharePoint Framework, Angular and Azure Funct...
SharePoint Saturday Twin Cities - SharePoint Framework, Angular & Azure Funct...
The future of templating and frameworks
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...
Whats next in templating
Open Apereo - Web components workshop
Future proofing design work with Web components
Agentforce World Tour Toronto '25 - Supercharge MuleSoft Development with Mod...
Prototype4Production Presented at FOSSASIA2015 at Singapore
European SharePoint Conference 2017 - SharePoint Framework, Angular & Azure F...
Svelte the future of frontend development
GWT Architectures and Lessons Learned (WJAX 2013)
Untangling spring week11
Professionalizing the Front-end
PuppetConf 2014 Killer R10K Workflow With Notes
Building a blog with an Onion Architecture
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)

PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Cloud computing and distributed systems.
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Modernizing your data center with Dell and AMD
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Empathic Computing: Creating Shared Understanding
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Encapsulation theory and applications.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Approach and Philosophy of On baking technology
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
Network Security Unit 5.pdf for BCA BBA.
Chapter 3 Spatial Domain Image Processing.pdf
“AI and Expert System Decision Support & Business Intelligence Systems”
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Big Data Technologies - Introduction.pptx
Cloud computing and distributed systems.
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Modernizing your data center with Dell and AMD
The Rise and Fall of 3GPP – Time for a Sabbatical?
Empathic Computing: Creating Shared Understanding
Unlocking AI with Model Context Protocol (MCP)
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
The AUB Centre for AI in Media Proposal.docx
Encapsulation theory and applications.pdf
Electronic commerce courselecture one. Pdf
Approach and Philosophy of On baking technology
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Dropbox Q2 2025 Financial Results & Investor Presentation

Angular ❤️ CMS from #AngularUp