(Go: >> BACK << -|- >> HOME <<)

SlideShare a Scribd company logo
© 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Build single page applications using AngularJS on AEM
David Benge | Lead Computer Scientist
© 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
What Is a Single Page Application?
wikipedia:
“A single-page application (SPA), is a web application or web site that
fits on a single web page with the goal of providing a more fluid user
experience akin to a desktop application. In a SPA, either all necessary
code – HTML, JavaScript, and CSS – is retrieved with a single page
load, or the appropriate resources are dynamically loaded and added to
the page as necessary, usually in response to user actions. The page
does not reload at any point in the process, nor does control transfer to
another page”
2
© 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Single Page Application Pro’s and Con’s
Pro’s
 Use of page fragments or partials speeds up
the loading of secondary pages
 Better mobile device experience
 Reduced number of resource requests across
the network greatly speeds up the applications
page transitions
 Lack of full page refresh creates a more app
like smoothness leading to a richer user
experience
3
Con’s
 Has Search Engine Optimization issues due to
the fact that pages/views rendering is driven
via javascript.
 Components and some core libs rely on the
document Ready event to initialize
 Speed of the initial load can be slow
 Not social sharing friendly. Twitter and
Facebook and others have issues when users
try to share SPA pages.
© 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
The Technical Reasons Are Great But Why Did I really Choose To Do An SPA?
4
• The debate on my development team between web and native has
become a religious war. It was time to see if we could get the experience
we want on the mobile experience without building a native application.
• Mobile applications have their place, but I believe a well built site can
convey the same information.
• Informational mobile apps without shared web content create data silos
that make discoverability and interoperability difficult.
• Responsive is a nice start but we wanted to take it further. We are also
experimenting with a concept we call ReDaptive. Watch our GitHub and
YouTube channels for more information in the future on this concept.
© 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
 Must have native application like smoothness on everything from the
high resolution desktop to the smartphone.
 Search and social friendly
 Works with AEM authoring
 Our development pattern needed to be easy to follow and understand
 No JSP; all Sightly
 Semantic html markup. Each page should be useable as a data
record based on markup
 Javascript needed to be balanced with markup. Avoid 500 js library
include madness
5
© 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 6
Our Proof Of Concept
Combine sling with Angular
© 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 7
• Custom base page component that allows pages to be either an Angular application
entry point or rendered as a view partial
• Angular JS code to control the application/site and its view navigation
• Rewrite rule to help handle search engines by adding a selector
• Based on runmode Base Page includes content or an Angular ui-view element
• Responsive design
• Custom video component that makes use of Adobe Dynamic Media and native HTML5
video tag markup. Selects best rendition to use based on the video element size and
browser device group detected
• Use of BrowseCap for device detection
• Nearly all Sightly
• Use of Less for style
• Adobe Analytics for metrics
• Uses AdobeAtAdobe boiler plate project - Available in our GIT repo
• Creative Cloud Extract used to build site from XD comps
• Photoshop used to develop the comps
• Adobe Edge inspect used to debug on devices
© 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
High Level Technical Overview Of The Base Page Component
 We created a standard page component that inherits from
wcm/foundation/components/page.
 This new base page component has a content.html include in the center. This is where
our page views get loaded. We change the markup based on if the request was made on
a publish or author environment.
 If the request was on author we do a standard content include.
 If it’s a page request on publish we don’t do the include and just insert the div with the
angular ui-view
<div class="page-content" ui-view data-sly-test="${teamsitePage.isPublisher && !teamsitePage.isSearchEngine}"></div>
<div data-sly-include="content.html" class="page-content" data-sly-test="${!teamsitePage.isPublisher ||
teamsitePage.isSearchEngine}"></div>
 In the base component we also include some meta data. We use this to tell angular and
other components how to behave based on the environment.
<meta name="publisher" content="${teamsitePage.isPublisher}"/>
<meta name="wcmmode" content="${teamsitePage.metaWcmMode}">
8
© 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
High Level Technical Overview Of The Standard Page Component
 All the pages inherit from the
base page
 Each new page component
includes their markup in a file
named content.html
 If needed they can include a
controller like in this example
 The controller code is stored in a
client lib under the page
component
9
<div class="contact-block" ng-controller="ContactController">
<div class="hi"><span>Hi. </span>How can we help you?</div>
<div class="methods">
<div class="method">
<div class="title">Technology Questions</div>
<div class="phone">+1 613 857 9233</div>
<div class="email">adobe@adobe.com</div>
</div>
<div class="method">
<div class="title">Work with Us</div>
<div class="phone">+1 613 857 9233</div>
<div class="email">adobe@adobe.com</div>
</div>
<div class="method">
<div class="title">Everything Else</div>
<div class="phone">+1 613 857 9233</div>
<div class="email">adobe@adobe.com</div>
</div>
</div>
</div>
</div>
© 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
High Level Technical Overview Of The Base Page Component Partial Selector
 Under the base page component we have a file named partial.html.
This file handles any request for a page that has the partial selection
appended to it. This file simply includes content.html with No header,
No footer, No navigation, just the meaty center of the view in our case.
 The partial also includes new metatags with data to replace the
header meta data. The new tags are prefixed with partial for example
partial:title. Its contents will replace the header metatag’s content for
title. The replacement of the metadata is handled by the Angular
application.
<meta name="partial:keywords" content="${head.keywords}" id="partialKeywords"/>
10
© 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
High Level Technical Overview Of The Base Page Component Partial Selector
We need to tell Angular about the site hierarchy because Angular will be
handling navigation from view to view. Angular controls the view
loading on the client side via a library called router.ui so it needs to
know how map urls to view partials.
Under the base page component we have a file named routes.json.jsp.
This file provides us a endpoint for Angular’s ui.router to use to load the
router and state provider on the fly on the first page load. One thing we
do alter on the routes is the value of the templateUrl returned from our
routes.json.jsp. On our page path we include a partial selector. Thanks
to the magic that is sling when we make that request now we will get
just the center conent of the page when we navigate from view to view.
11
© 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
High Level Technical Overview Of The Base Page Component Angular Router
12
Example output from our routes.json.jsp file is
shown to the left.
This is an example of how we are rewriting out our
routes and re-writing the templateUrl to include the
.partial selector.
Example /content/teamsite/work.html
becomes
/content/teamsite/work.partial.html
When the application/site is loaded in the browser
any link or navigation to a url for example
/content/teamsite/work/cmo.html is handled by the
$location service. It will resolve the url to the
templateUrl which is set to
/content/teamsite/work/cmo.partial.html.
The request to
/content/teamsite/work/cmo.partial.html will be
returned as just the center of the view and injected
into the existing page.
© 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
So Far This Is What It Looks Like On The AEM Page Component Side
13
© 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
High Technical Overview Of The Proof Of Concept – Component Conclusion
So that’s it for the AEM side of the application. Once the base component pattern was
established it was easy to work with.
Its all fairly normal AEM component and page development from that point on. With a few
exceptions for stock components that make heavy use of the document ready event.
Summary
 In author runmode, it will do full page refreshes
 Search engine friendly due to the fact there is a full page request
 On social shares of a page, the path exists
 In publish run mode, the client side will do partial page refresh
Thanks to the magic of sling resolution we are able to serve full pages or partials as
needed. Every path can be an entry point to our SPA base application.
14
© 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 15
The Angular Bits
© 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
The Angular Js bits we used to round out this solution are:
 Controller – Controllers ended up being minimally used at the page
level. Router.ui – used to load and control the routes. We also use the
routing events to load page meta data
 Service – We have a service that helps with pulling and setting meta
data on the page
 Directives – We have a few to provide functionality
 Custom html5 video player directive
 Explore page directive to help with the scrolling and other ui bits on
the explore page
 Angular Carousel which drives the image carousels
16
© 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Whats Next?
17
• We will be adding more functionality to the proof of concept
site
• We are really liking directives and plan to do more work in that
area and investigate using polymer
• Clean up of the header libs to remove some of the
dependency on document ready event
© 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.
Code is located in out Github repo https://github.com/AdobeAtAdobe
Live site can be found at http://www.adobeatadobe.com
Twitter @AdobeAtAdobe
Video sessions on this proof of concept will be posted on
our YouTube channel https://www.youtube.com/user/AdobeAtAdobe

More Related Content

What's hot

The virtual DOM and how react uses it internally
The virtual DOM and how react uses it internallyThe virtual DOM and how react uses it internally
The virtual DOM and how react uses it internally
Clóvis Neto
 
SPA Editor - Adobe Experience Manager Sites
SPA Editor - Adobe Experience Manager SitesSPA Editor - Adobe Experience Manager Sites
SPA Editor - Adobe Experience Manager Sites
Gabriel Walt
 
Elasticsearch
ElasticsearchElasticsearch
Elasticsearch
Hermeto Romano
 
Introduction To Single Page Application
Introduction To Single Page ApplicationIntroduction To Single Page Application
Introduction To Single Page Application
KMS Technology
 
Osgi
OsgiOsgi
Bootstrap 3
Bootstrap 3Bootstrap 3
Bootstrap 3
Lanh Le
 
Basics of React Hooks.pptx.pdf
Basics of React Hooks.pptx.pdfBasics of React Hooks.pptx.pdf
Basics of React Hooks.pptx.pdf
Knoldus Inc.
 
Redshift overview
Redshift overviewRedshift overview
Redshift overview
Amazon Web Services LATAM
 
Creating xml publisher documents with people code
Creating xml publisher documents with people codeCreating xml publisher documents with people code
Creating xml publisher documents with people code
Randall Groncki
 
ASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with OverviewASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with Overview
Shahed Chowdhuri
 
Dynamic components using SPA concepts in AEM
Dynamic components using SPA concepts in AEMDynamic components using SPA concepts in AEM
Dynamic components using SPA concepts in AEM
Bojana Popovska
 
AEM Best Practices for Component Development
AEM Best Practices for Component DevelopmentAEM Best Practices for Component Development
AEM Best Practices for Component Development
Gabriel Walt
 
Domain Driven Design 101
Domain Driven Design 101Domain Driven Design 101
Domain Driven Design 101
Richard Dingwall
 
효율적인 빅데이터 분석 및 처리를 위한 Glue, EMR 활용 - 김태현 솔루션즈 아키텍트, AWS :: AWS Summit Seoul 2019
효율적인 빅데이터 분석 및 처리를 위한 Glue, EMR 활용 - 김태현 솔루션즈 아키텍트, AWS :: AWS Summit Seoul 2019효율적인 빅데이터 분석 및 처리를 위한 Glue, EMR 활용 - 김태현 솔루션즈 아키텍트, AWS :: AWS Summit Seoul 2019
효율적인 빅데이터 분석 및 처리를 위한 Glue, EMR 활용 - 김태현 솔루션즈 아키텍트, AWS :: AWS Summit Seoul 2019
Amazon Web Services Korea
 
REST in AEM by Roy Fielding
REST in AEM by Roy FieldingREST in AEM by Roy Fielding
REST in AEM by Roy Fielding
AEM HUB
 
Flex box
Flex boxFlex box
Flex box
Harish Karthick
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
Apaichon Punopas
 
AEM & eCommerce integration
AEM & eCommerce integrationAEM & eCommerce integration
AEM & eCommerce integration
Lokesh BS
 
Single page application
Single page applicationSingle page application
Single page application
Arthur Fung
 
Flexbox
FlexboxFlexbox
Flexbox
Netcetera
 

What's hot (20)

The virtual DOM and how react uses it internally
The virtual DOM and how react uses it internallyThe virtual DOM and how react uses it internally
The virtual DOM and how react uses it internally
 
SPA Editor - Adobe Experience Manager Sites
SPA Editor - Adobe Experience Manager SitesSPA Editor - Adobe Experience Manager Sites
SPA Editor - Adobe Experience Manager Sites
 
Elasticsearch
ElasticsearchElasticsearch
Elasticsearch
 
Introduction To Single Page Application
Introduction To Single Page ApplicationIntroduction To Single Page Application
Introduction To Single Page Application
 
Osgi
OsgiOsgi
Osgi
 
Bootstrap 3
Bootstrap 3Bootstrap 3
Bootstrap 3
 
Basics of React Hooks.pptx.pdf
Basics of React Hooks.pptx.pdfBasics of React Hooks.pptx.pdf
Basics of React Hooks.pptx.pdf
 
Redshift overview
Redshift overviewRedshift overview
Redshift overview
 
Creating xml publisher documents with people code
Creating xml publisher documents with people codeCreating xml publisher documents with people code
Creating xml publisher documents with people code
 
ASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with OverviewASP.NET Core MVC + Web API with Overview
ASP.NET Core MVC + Web API with Overview
 
Dynamic components using SPA concepts in AEM
Dynamic components using SPA concepts in AEMDynamic components using SPA concepts in AEM
Dynamic components using SPA concepts in AEM
 
AEM Best Practices for Component Development
AEM Best Practices for Component DevelopmentAEM Best Practices for Component Development
AEM Best Practices for Component Development
 
Domain Driven Design 101
Domain Driven Design 101Domain Driven Design 101
Domain Driven Design 101
 
효율적인 빅데이터 분석 및 처리를 위한 Glue, EMR 활용 - 김태현 솔루션즈 아키텍트, AWS :: AWS Summit Seoul 2019
효율적인 빅데이터 분석 및 처리를 위한 Glue, EMR 활용 - 김태현 솔루션즈 아키텍트, AWS :: AWS Summit Seoul 2019효율적인 빅데이터 분석 및 처리를 위한 Glue, EMR 활용 - 김태현 솔루션즈 아키텍트, AWS :: AWS Summit Seoul 2019
효율적인 빅데이터 분석 및 처리를 위한 Glue, EMR 활용 - 김태현 솔루션즈 아키텍트, AWS :: AWS Summit Seoul 2019
 
REST in AEM by Roy Fielding
REST in AEM by Roy FieldingREST in AEM by Roy Fielding
REST in AEM by Roy Fielding
 
Flex box
Flex boxFlex box
Flex box
 
NodeJS for Beginner
NodeJS for BeginnerNodeJS for Beginner
NodeJS for Beginner
 
AEM & eCommerce integration
AEM & eCommerce integrationAEM & eCommerce integration
AEM & eCommerce integration
 
Single page application
Single page applicationSingle page application
Single page application
 
Flexbox
FlexboxFlexbox
Flexbox
 

Similar to Build single page applications using AngularJS on AEM

How to make React Applications SEO-friendly
How to make React Applications SEO-friendlyHow to make React Applications SEO-friendly
How to make React Applications SEO-friendly
Fibonalabs
 
Angular webinar - Credo Systemz
Angular webinar - Credo SystemzAngular webinar - Credo Systemz
Angular webinar - Credo Systemz
Training Institute
 
Google app development
Google app developmentGoogle app development
Google app development
Aurel Medvegy
 
Google app developers
Google app developersGoogle app developers
Google app developers
Aurel Medvegy
 
Google development
Google developmentGoogle development
Google development
Aurel Medvegy
 
Google app
Google appGoogle app
Google app
Aurel Medvegy
 
Web software development
Web software developmentWeb software development
Web software development
Aurel Medvegy
 
Google app developer
Google app developerGoogle app developer
Google app developer
Aurel Medvegy
 
Google web tools
Google web toolsGoogle web tools
Google web tools
Aurel Medvegy
 
Google apps development
Google apps developmentGoogle apps development
Google apps development
Aurel Medvegy
 
Google app example
Google app exampleGoogle app example
Google app example
Aurel Medvegy
 
Create a google app
Create a google appCreate a google app
Create a google app
Aurel Medvegy
 
Google app engine own domain
Google app engine own domainGoogle app engine own domain
Google app engine own domain
Aurel Medvegy
 
Google webtools
Google webtoolsGoogle webtools
Google webtools
Aurel Medvegy
 
Google app engine applications
Google app engine applicationsGoogle app engine applications
Google app engine applications
Aurel Medvegy
 
App engine domain name
App engine domain nameApp engine domain name
App engine domain name
Aurel Medvegy
 
Google sites development
Google sites developmentGoogle sites development
Google sites development
Aurel Medvegy
 
Google app pricing
Google app pricingGoogle app pricing
Google app pricing
Aurel Medvegy
 
Google app engine example apps
Google app engine example appsGoogle app engine example apps
Google app engine example apps
Aurel Medvegy
 
Google app engine json
Google app engine jsonGoogle app engine json
Google app engine json
Aurel Medvegy
 

Similar to Build single page applications using AngularJS on AEM (20)

How to make React Applications SEO-friendly
How to make React Applications SEO-friendlyHow to make React Applications SEO-friendly
How to make React Applications SEO-friendly
 
Angular webinar - Credo Systemz
Angular webinar - Credo SystemzAngular webinar - Credo Systemz
Angular webinar - Credo Systemz
 
Google app development
Google app developmentGoogle app development
Google app development
 
Google app developers
Google app developersGoogle app developers
Google app developers
 
Google development
Google developmentGoogle development
Google development
 
Google app
Google appGoogle app
Google app
 
Web software development
Web software developmentWeb software development
Web software development
 
Google app developer
Google app developerGoogle app developer
Google app developer
 
Google web tools
Google web toolsGoogle web tools
Google web tools
 
Google apps development
Google apps developmentGoogle apps development
Google apps development
 
Google app example
Google app exampleGoogle app example
Google app example
 
Create a google app
Create a google appCreate a google app
Create a google app
 
Google app engine own domain
Google app engine own domainGoogle app engine own domain
Google app engine own domain
 
Google webtools
Google webtoolsGoogle webtools
Google webtools
 
Google app engine applications
Google app engine applicationsGoogle app engine applications
Google app engine applications
 
App engine domain name
App engine domain nameApp engine domain name
App engine domain name
 
Google sites development
Google sites developmentGoogle sites development
Google sites development
 
Google app pricing
Google app pricingGoogle app pricing
Google app pricing
 
Google app engine example apps
Google app engine example appsGoogle app engine example apps
Google app engine example apps
 
Google app engine json
Google app engine jsonGoogle app engine json
Google app engine json
 

More from AdobeMarketingCloud

Adobe Ask the AEM Community Expert Session Oct 2016
Adobe Ask the AEM Community Expert Session Oct 2016Adobe Ask the AEM Community Expert Session Oct 2016
Adobe Ask the AEM Community Expert Session Oct 2016
AdobeMarketingCloud
 
Ask the expert AEM Assets best practices 092016
Ask the expert  AEM Assets best practices 092016Ask the expert  AEM Assets best practices 092016
Ask the expert AEM Assets best practices 092016
AdobeMarketingCloud
 
AEM GEMS Session Template Editor Sept 14 2016
AEM GEMS Session Template Editor Sept 14 2016AEM GEMS Session Template Editor Sept 14 2016
AEM GEMS Session Template Editor Sept 14 2016
AdobeMarketingCloud
 
AEM GEMS Session SAML authentication in AEM
AEM GEMS Session SAML authentication in AEMAEM GEMS Session SAML authentication in AEM
AEM GEMS Session SAML authentication in AEM
AdobeMarketingCloud
 
Immerse 2016 Efficient publishing with content fragments
Immerse 2016 Efficient publishing with content fragmentsImmerse 2016 Efficient publishing with content fragments
Immerse 2016 Efficient publishing with content fragments
AdobeMarketingCloud
 
IMMERSE 2016 Introducing content fragments
IMMERSE 2016 Introducing content fragmentsIMMERSE 2016 Introducing content fragments
IMMERSE 2016 Introducing content fragments
AdobeMarketingCloud
 
IMMERSE 2016 Cedric Huesler US Keynote
IMMERSE 2016 Cedric Huesler US KeynoteIMMERSE 2016 Cedric Huesler US Keynote
IMMERSE 2016 Cedric Huesler US Keynote
AdobeMarketingCloud
 
IMMERSE 2016 IST Mark Szulc Keynote
IMMERSE 2016 IST Mark Szulc KeynoteIMMERSE 2016 IST Mark Szulc Keynote
IMMERSE 2016 IST Mark Szulc Keynote
AdobeMarketingCloud
 
AEM GEMs Session Oak Lucene Indexes
AEM GEMs Session Oak Lucene IndexesAEM GEMs Session Oak Lucene Indexes
AEM GEMs Session Oak Lucene Indexes
AdobeMarketingCloud
 
IMMERSE'16 Intro to Adobe Experience Manager & Adobe Marketing Cloud
IMMERSE'16 Intro to Adobe Experience Manager & Adobe Marketing CloudIMMERSE'16 Intro to Adobe Experience Manager & Adobe Marketing Cloud
IMMERSE'16 Intro to Adobe Experience Manager & Adobe Marketing Cloud
AdobeMarketingCloud
 
IMMERSE'16 Introduction to AEM Tooling
IMMERSE'16 Introduction to AEM ToolingIMMERSE'16 Introduction to AEM Tooling
IMMERSE'16 Introduction to AEM Tooling
AdobeMarketingCloud
 
Introduction to Adobe Experience Manager based e commerce
Introduction to Adobe Experience Manager based e commerceIntroduction to Adobe Experience Manager based e commerce
Introduction to Adobe Experience Manager based e commerce
AdobeMarketingCloud
 
IMMERSE'16 Introduction to adobe experience manager back end
IMMERSE'16 Introduction to adobe experience manager back endIMMERSE'16 Introduction to adobe experience manager back end
IMMERSE'16 Introduction to adobe experience manager back end
AdobeMarketingCloud
 
Ask the AEM Community Expert Feb 2016 Session: AEM + Brackets
Ask the AEM Community Expert Feb 2016 Session: AEM + BracketsAsk the AEM Community Expert Feb 2016 Session: AEM + Brackets
Ask the AEM Community Expert Feb 2016 Session: AEM + Brackets
AdobeMarketingCloud
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEM
AdobeMarketingCloud
 

More from AdobeMarketingCloud (15)

Adobe Ask the AEM Community Expert Session Oct 2016
Adobe Ask the AEM Community Expert Session Oct 2016Adobe Ask the AEM Community Expert Session Oct 2016
Adobe Ask the AEM Community Expert Session Oct 2016
 
Ask the expert AEM Assets best practices 092016
Ask the expert  AEM Assets best practices 092016Ask the expert  AEM Assets best practices 092016
Ask the expert AEM Assets best practices 092016
 
AEM GEMS Session Template Editor Sept 14 2016
AEM GEMS Session Template Editor Sept 14 2016AEM GEMS Session Template Editor Sept 14 2016
AEM GEMS Session Template Editor Sept 14 2016
 
AEM GEMS Session SAML authentication in AEM
AEM GEMS Session SAML authentication in AEMAEM GEMS Session SAML authentication in AEM
AEM GEMS Session SAML authentication in AEM
 
Immerse 2016 Efficient publishing with content fragments
Immerse 2016 Efficient publishing with content fragmentsImmerse 2016 Efficient publishing with content fragments
Immerse 2016 Efficient publishing with content fragments
 
IMMERSE 2016 Introducing content fragments
IMMERSE 2016 Introducing content fragmentsIMMERSE 2016 Introducing content fragments
IMMERSE 2016 Introducing content fragments
 
IMMERSE 2016 Cedric Huesler US Keynote
IMMERSE 2016 Cedric Huesler US KeynoteIMMERSE 2016 Cedric Huesler US Keynote
IMMERSE 2016 Cedric Huesler US Keynote
 
IMMERSE 2016 IST Mark Szulc Keynote
IMMERSE 2016 IST Mark Szulc KeynoteIMMERSE 2016 IST Mark Szulc Keynote
IMMERSE 2016 IST Mark Szulc Keynote
 
AEM GEMs Session Oak Lucene Indexes
AEM GEMs Session Oak Lucene IndexesAEM GEMs Session Oak Lucene Indexes
AEM GEMs Session Oak Lucene Indexes
 
IMMERSE'16 Intro to Adobe Experience Manager & Adobe Marketing Cloud
IMMERSE'16 Intro to Adobe Experience Manager & Adobe Marketing CloudIMMERSE'16 Intro to Adobe Experience Manager & Adobe Marketing Cloud
IMMERSE'16 Intro to Adobe Experience Manager & Adobe Marketing Cloud
 
IMMERSE'16 Introduction to AEM Tooling
IMMERSE'16 Introduction to AEM ToolingIMMERSE'16 Introduction to AEM Tooling
IMMERSE'16 Introduction to AEM Tooling
 
Introduction to Adobe Experience Manager based e commerce
Introduction to Adobe Experience Manager based e commerceIntroduction to Adobe Experience Manager based e commerce
Introduction to Adobe Experience Manager based e commerce
 
IMMERSE'16 Introduction to adobe experience manager back end
IMMERSE'16 Introduction to adobe experience manager back endIMMERSE'16 Introduction to adobe experience manager back end
IMMERSE'16 Introduction to adobe experience manager back end
 
Ask the AEM Community Expert Feb 2016 Session: AEM + Brackets
Ask the AEM Community Expert Feb 2016 Session: AEM + BracketsAsk the AEM Community Expert Feb 2016 Session: AEM + Brackets
Ask the AEM Community Expert Feb 2016 Session: AEM + Brackets
 
Build single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEMBuild single page applications using AngularJS on AEM
Build single page applications using AngularJS on AEM
 

Recently uploaded

GDG Cloud Southlake #34: Neatsun Ziv: Automating Appsec
GDG Cloud Southlake #34: Neatsun Ziv: Automating AppsecGDG Cloud Southlake #34: Neatsun Ziv: Automating Appsec
GDG Cloud Southlake #34: Neatsun Ziv: Automating Appsec
James Anderson
 
HTTP Adaptive Streaming – Quo Vadis (2024)
HTTP Adaptive Streaming – Quo Vadis (2024)HTTP Adaptive Streaming – Quo Vadis (2024)
HTTP Adaptive Streaming – Quo Vadis (2024)
Alpen-Adria-Universität
 
K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024
The Digital Insurer
 
Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...
BookNet Canada
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
BookNet Canada
 
How to Avoid Learning the Linux-Kernel Memory Model
How to Avoid Learning the Linux-Kernel Memory ModelHow to Avoid Learning the Linux-Kernel Memory Model
How to Avoid Learning the Linux-Kernel Memory Model
ScyllaDB
 
Why do You Have to Redesign?_Redesign Challenge Day 1
Why do You Have to Redesign?_Redesign Challenge Day 1Why do You Have to Redesign?_Redesign Challenge Day 1
Why do You Have to Redesign?_Redesign Challenge Day 1
FellyciaHikmahwarani
 
How RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptxHow RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptx
SynapseIndia
 
Performance Budgets for the Real World by Tammy Everts
Performance Budgets for the Real World by Tammy EvertsPerformance Budgets for the Real World by Tammy Everts
Performance Budgets for the Real World by Tammy Everts
ScyllaDB
 
Navigating Post-Quantum Blockchain: Resilient Cryptography in Quantum Threats
Navigating Post-Quantum Blockchain: Resilient Cryptography in Quantum ThreatsNavigating Post-Quantum Blockchain: Resilient Cryptography in Quantum Threats
Navigating Post-Quantum Blockchain: Resilient Cryptography in Quantum Threats
anupriti
 
UiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs ConferenceUiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs Conference
UiPathCommunity
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
Matthew Sinclair
 
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Erasmo Purificato
 
DealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 editionDealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 edition
Yevgen Sysoyev
 
5G bootcamp Sep 2020 (NPI initiative).pptx
5G bootcamp Sep 2020 (NPI initiative).pptx5G bootcamp Sep 2020 (NPI initiative).pptx
5G bootcamp Sep 2020 (NPI initiative).pptx
SATYENDRA100
 
AI_dev Europe 2024 - From OpenAI to Opensource AI
AI_dev Europe 2024 - From OpenAI to Opensource AIAI_dev Europe 2024 - From OpenAI to Opensource AI
AI_dev Europe 2024 - From OpenAI to Opensource AI
Raphaël Semeteys
 
Running a Go App in Kubernetes: CPU Impacts
Running a Go App in Kubernetes: CPU ImpactsRunning a Go App in Kubernetes: CPU Impacts
Running a Go App in Kubernetes: CPU Impacts
ScyllaDB
 
Data Protection in a Connected World: Sovereignty and Cyber Security
Data Protection in a Connected World: Sovereignty and Cyber SecurityData Protection in a Connected World: Sovereignty and Cyber Security
Data Protection in a Connected World: Sovereignty and Cyber Security
anupriti
 
Verti - EMEA Insurer Innovation Award 2024
Verti - EMEA Insurer Innovation Award 2024Verti - EMEA Insurer Innovation Award 2024
Verti - EMEA Insurer Innovation Award 2024
The Digital Insurer
 
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdfPigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions
 

Recently uploaded (20)

GDG Cloud Southlake #34: Neatsun Ziv: Automating Appsec
GDG Cloud Southlake #34: Neatsun Ziv: Automating AppsecGDG Cloud Southlake #34: Neatsun Ziv: Automating Appsec
GDG Cloud Southlake #34: Neatsun Ziv: Automating Appsec
 
HTTP Adaptive Streaming – Quo Vadis (2024)
HTTP Adaptive Streaming – Quo Vadis (2024)HTTP Adaptive Streaming – Quo Vadis (2024)
HTTP Adaptive Streaming – Quo Vadis (2024)
 
K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024K2G - Insurtech Innovation EMEA Award 2024
K2G - Insurtech Innovation EMEA Award 2024
 
Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...Transcript: Details of description part II: Describing images in practice - T...
Transcript: Details of description part II: Describing images in practice - T...
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
 
How to Avoid Learning the Linux-Kernel Memory Model
How to Avoid Learning the Linux-Kernel Memory ModelHow to Avoid Learning the Linux-Kernel Memory Model
How to Avoid Learning the Linux-Kernel Memory Model
 
Why do You Have to Redesign?_Redesign Challenge Day 1
Why do You Have to Redesign?_Redesign Challenge Day 1Why do You Have to Redesign?_Redesign Challenge Day 1
Why do You Have to Redesign?_Redesign Challenge Day 1
 
How RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptxHow RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptx
 
Performance Budgets for the Real World by Tammy Everts
Performance Budgets for the Real World by Tammy EvertsPerformance Budgets for the Real World by Tammy Everts
Performance Budgets for the Real World by Tammy Everts
 
Navigating Post-Quantum Blockchain: Resilient Cryptography in Quantum Threats
Navigating Post-Quantum Blockchain: Resilient Cryptography in Quantum ThreatsNavigating Post-Quantum Blockchain: Resilient Cryptography in Quantum Threats
Navigating Post-Quantum Blockchain: Resilient Cryptography in Quantum Threats
 
UiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs ConferenceUiPath Community Day Kraków: Devs4Devs Conference
UiPath Community Day Kraków: Devs4Devs Conference
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
 
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
Paradigm Shifts in User Modeling: A Journey from Historical Foundations to Em...
 
DealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 editionDealBook of Ukraine: 2024 edition
DealBook of Ukraine: 2024 edition
 
5G bootcamp Sep 2020 (NPI initiative).pptx
5G bootcamp Sep 2020 (NPI initiative).pptx5G bootcamp Sep 2020 (NPI initiative).pptx
5G bootcamp Sep 2020 (NPI initiative).pptx
 
AI_dev Europe 2024 - From OpenAI to Opensource AI
AI_dev Europe 2024 - From OpenAI to Opensource AIAI_dev Europe 2024 - From OpenAI to Opensource AI
AI_dev Europe 2024 - From OpenAI to Opensource AI
 
Running a Go App in Kubernetes: CPU Impacts
Running a Go App in Kubernetes: CPU ImpactsRunning a Go App in Kubernetes: CPU Impacts
Running a Go App in Kubernetes: CPU Impacts
 
Data Protection in a Connected World: Sovereignty and Cyber Security
Data Protection in a Connected World: Sovereignty and Cyber SecurityData Protection in a Connected World: Sovereignty and Cyber Security
Data Protection in a Connected World: Sovereignty and Cyber Security
 
Verti - EMEA Insurer Innovation Award 2024
Verti - EMEA Insurer Innovation Award 2024Verti - EMEA Insurer Innovation Award 2024
Verti - EMEA Insurer Innovation Award 2024
 
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdfPigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdf
 

Build single page applications using AngularJS on AEM

  • 1. © 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Build single page applications using AngularJS on AEM David Benge | Lead Computer Scientist
  • 2. © 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. What Is a Single Page Application? wikipedia: “A single-page application (SPA), is a web application or web site that fits on a single web page with the goal of providing a more fluid user experience akin to a desktop application. In a SPA, either all necessary code – HTML, JavaScript, and CSS – is retrieved with a single page load, or the appropriate resources are dynamically loaded and added to the page as necessary, usually in response to user actions. The page does not reload at any point in the process, nor does control transfer to another page” 2
  • 3. © 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Single Page Application Pro’s and Con’s Pro’s  Use of page fragments or partials speeds up the loading of secondary pages  Better mobile device experience  Reduced number of resource requests across the network greatly speeds up the applications page transitions  Lack of full page refresh creates a more app like smoothness leading to a richer user experience 3 Con’s  Has Search Engine Optimization issues due to the fact that pages/views rendering is driven via javascript.  Components and some core libs rely on the document Ready event to initialize  Speed of the initial load can be slow  Not social sharing friendly. Twitter and Facebook and others have issues when users try to share SPA pages.
  • 4. © 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. The Technical Reasons Are Great But Why Did I really Choose To Do An SPA? 4 • The debate on my development team between web and native has become a religious war. It was time to see if we could get the experience we want on the mobile experience without building a native application. • Mobile applications have their place, but I believe a well built site can convey the same information. • Informational mobile apps without shared web content create data silos that make discoverability and interoperability difficult. • Responsive is a nice start but we wanted to take it further. We are also experimenting with a concept we call ReDaptive. Watch our GitHub and YouTube channels for more information in the future on this concept.
  • 5. © 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential.  Must have native application like smoothness on everything from the high resolution desktop to the smartphone.  Search and social friendly  Works with AEM authoring  Our development pattern needed to be easy to follow and understand  No JSP; all Sightly  Semantic html markup. Each page should be useable as a data record based on markup  Javascript needed to be balanced with markup. Avoid 500 js library include madness 5
  • 6. © 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 6 Our Proof Of Concept Combine sling with Angular
  • 7. © 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 7 • Custom base page component that allows pages to be either an Angular application entry point or rendered as a view partial • Angular JS code to control the application/site and its view navigation • Rewrite rule to help handle search engines by adding a selector • Based on runmode Base Page includes content or an Angular ui-view element • Responsive design • Custom video component that makes use of Adobe Dynamic Media and native HTML5 video tag markup. Selects best rendition to use based on the video element size and browser device group detected • Use of BrowseCap for device detection • Nearly all Sightly • Use of Less for style • Adobe Analytics for metrics • Uses AdobeAtAdobe boiler plate project - Available in our GIT repo • Creative Cloud Extract used to build site from XD comps • Photoshop used to develop the comps • Adobe Edge inspect used to debug on devices
  • 8. © 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. High Level Technical Overview Of The Base Page Component  We created a standard page component that inherits from wcm/foundation/components/page.  This new base page component has a content.html include in the center. This is where our page views get loaded. We change the markup based on if the request was made on a publish or author environment.  If the request was on author we do a standard content include.  If it’s a page request on publish we don’t do the include and just insert the div with the angular ui-view <div class="page-content" ui-view data-sly-test="${teamsitePage.isPublisher && !teamsitePage.isSearchEngine}"></div> <div data-sly-include="content.html" class="page-content" data-sly-test="${!teamsitePage.isPublisher || teamsitePage.isSearchEngine}"></div>  In the base component we also include some meta data. We use this to tell angular and other components how to behave based on the environment. <meta name="publisher" content="${teamsitePage.isPublisher}"/> <meta name="wcmmode" content="${teamsitePage.metaWcmMode}"> 8
  • 9. © 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. High Level Technical Overview Of The Standard Page Component  All the pages inherit from the base page  Each new page component includes their markup in a file named content.html  If needed they can include a controller like in this example  The controller code is stored in a client lib under the page component 9 <div class="contact-block" ng-controller="ContactController"> <div class="hi"><span>Hi. </span>How can we help you?</div> <div class="methods"> <div class="method"> <div class="title">Technology Questions</div> <div class="phone">+1 613 857 9233</div> <div class="email">adobe@adobe.com</div> </div> <div class="method"> <div class="title">Work with Us</div> <div class="phone">+1 613 857 9233</div> <div class="email">adobe@adobe.com</div> </div> <div class="method"> <div class="title">Everything Else</div> <div class="phone">+1 613 857 9233</div> <div class="email">adobe@adobe.com</div> </div> </div> </div> </div>
  • 10. © 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. High Level Technical Overview Of The Base Page Component Partial Selector  Under the base page component we have a file named partial.html. This file handles any request for a page that has the partial selection appended to it. This file simply includes content.html with No header, No footer, No navigation, just the meaty center of the view in our case.  The partial also includes new metatags with data to replace the header meta data. The new tags are prefixed with partial for example partial:title. Its contents will replace the header metatag’s content for title. The replacement of the metadata is handled by the Angular application. <meta name="partial:keywords" content="${head.keywords}" id="partialKeywords"/> 10
  • 11. © 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. High Level Technical Overview Of The Base Page Component Partial Selector We need to tell Angular about the site hierarchy because Angular will be handling navigation from view to view. Angular controls the view loading on the client side via a library called router.ui so it needs to know how map urls to view partials. Under the base page component we have a file named routes.json.jsp. This file provides us a endpoint for Angular’s ui.router to use to load the router and state provider on the fly on the first page load. One thing we do alter on the routes is the value of the templateUrl returned from our routes.json.jsp. On our page path we include a partial selector. Thanks to the magic that is sling when we make that request now we will get just the center conent of the page when we navigate from view to view. 11
  • 12. © 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. High Level Technical Overview Of The Base Page Component Angular Router 12 Example output from our routes.json.jsp file is shown to the left. This is an example of how we are rewriting out our routes and re-writing the templateUrl to include the .partial selector. Example /content/teamsite/work.html becomes /content/teamsite/work.partial.html When the application/site is loaded in the browser any link or navigation to a url for example /content/teamsite/work/cmo.html is handled by the $location service. It will resolve the url to the templateUrl which is set to /content/teamsite/work/cmo.partial.html. The request to /content/teamsite/work/cmo.partial.html will be returned as just the center of the view and injected into the existing page.
  • 13. © 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. So Far This Is What It Looks Like On The AEM Page Component Side 13
  • 14. © 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. High Technical Overview Of The Proof Of Concept – Component Conclusion So that’s it for the AEM side of the application. Once the base component pattern was established it was easy to work with. Its all fairly normal AEM component and page development from that point on. With a few exceptions for stock components that make heavy use of the document ready event. Summary  In author runmode, it will do full page refreshes  Search engine friendly due to the fact there is a full page request  On social shares of a page, the path exists  In publish run mode, the client side will do partial page refresh Thanks to the magic of sling resolution we are able to serve full pages or partials as needed. Every path can be an entry point to our SPA base application. 14
  • 15. © 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. 15 The Angular Bits
  • 16. © 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. The Angular Js bits we used to round out this solution are:  Controller – Controllers ended up being minimally used at the page level. Router.ui – used to load and control the routes. We also use the routing events to load page meta data  Service – We have a service that helps with pulling and setting meta data on the page  Directives – We have a few to provide functionality  Custom html5 video player directive  Explore page directive to help with the scrolling and other ui bits on the explore page  Angular Carousel which drives the image carousels 16
  • 17. © 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Whats Next? 17 • We will be adding more functionality to the proof of concept site • We are really liking directives and plan to do more work in that area and investigate using polymer • Clean up of the header libs to remove some of the dependency on document ready event
  • 18. © 2015 Adobe Systems Incorporated. All Rights Reserved. Adobe Confidential. Code is located in out Github repo https://github.com/AdobeAtAdobe Live site can be found at http://www.adobeatadobe.com Twitter @AdobeAtAdobe Video sessions on this proof of concept will be posted on our YouTube channel https://www.youtube.com/user/AdobeAtAdobe