spas with angularjs and sitecore

23

Upload: psyche

Post on 23-Feb-2016

439 views

Category:

Documents


1 download

DESCRIPTION

Spas with angularjs and sitecore. SPA Framework. Up-Front Loading Eliminate DOM Manipulation Nested Views TDD. Intro to AngularJS. Dynamic views Testability Separation of c oncerns (MVC). Templates. MVC. Model View Controller Loose coupling between UI, data and rendering rules. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Spas with  angularjs  and  sitecore
Page 2: Spas with  angularjs  and  sitecore

SPAS WITH ANGULARJS AND SITECORE

Page 3: Spas with  angularjs  and  sitecore

SPA Framework• Up-Front Loading• Eliminate DOM Manipulation• Nested Views• TDD

Page 4: Spas with  angularjs  and  sitecore

Intro to AngularJS• Dynamic views• Testability• Separation of concerns (MVC)

Page 5: Spas with  angularjs  and  sitecore

Templates

Page 6: Spas with  angularjs  and  sitecore

MVC• Model• View• Controller

• Loose coupling between UI, data and rendering rules

Page 7: Spas with  angularjs  and  sitecore

Model

• Angular Models are POJOs• No HTML

Page 8: Spas with  angularjs  and  sitecore

View

Page 9: Spas with  angularjs  and  sitecore

Controller

Page 10: Spas with  angularjs  and  sitecore

Dependency Injection• DI in Controllers:

• DI in Factory Methods

Page 11: Spas with  angularjs  and  sitecore

Angular Directives• Angular API Directives– ng-app– ng-view– ng-click– ng-repeat– ng-model– ng-controller* Often see data-ng (valid HTML)

Page 12: Spas with  angularjs  and  sitecore

Data Binding

*source: http://docs.angularjs.org/tutorial/step_04

Page 13: Spas with  angularjs  and  sitecore

Routes• Hashtag Routing

• Routing Wire-up

Page 14: Spas with  angularjs  and  sitecore

Three Demos• Angular Standalone• Angular + Sitecore Item Web API• Angular Integrated in Sitecore

Page 15: Spas with  angularjs  and  sitecore

Demo #1• Angular: Standalone App

Page 16: Spas with  angularjs  and  sitecore

Angular SPA• Advantages– No customization required– Very light-weight

• Disadvantages– Static content

Page 17: Spas with  angularjs  and  sitecore

Demo #2• Angular: Sitecore Item Web API

Page 18: Spas with  angularjs  and  sitecore

Angular + Web API• Advantages– Still light-weight– Dynamic content

• Disadvantages– No Sitecore layout access

• Considerations– Security: Web API access– Performance: Web API calls– Cross Domain Calls

Page 19: Spas with  angularjs  and  sitecore

Demo #3• Angular: Sitecore Integrated

Page 20: Spas with  angularjs  and  sitecore

Angular + Sitecore• Advantages– Dynamic content– Dynamic renderings

• Disadvantages– Large dependency on SPA

• Considerations– Caching– DMS & Tracking– Page Editor– Workflows (HTML validation)

Page 21: Spas with  angularjs  and  sitecore

When to use Angular

• It’s an Application, not a website• SEO is not a concern• Behind a login• Need to limit page refreshes

Page 22: Spas with  angularjs  and  sitecore

Useful Links• Side Waffle

– http://sidewaffle.com/• John Papa

– http://www.johnpapa.net/• Year of Moo

– http://www.yearofmoo.com/• Angular Tutorial

– http://docs.angularjs.org/tutorial• Angular Core NuGet

– http://www.nuget.org/packages/angularjs.core– v1.2.1 is current (11/20/13)

Page 23: Spas with  angularjs  and  sitecore

Q&A• Code: https://

github.com/PetersonDave/SinglePageAppDemo

• Twitter: @PetersonDave• Blog: http://petersondave.wordpress.com

• ISITE Design:http://isitedesign.com

• Built With Sitecore:http://www.isitedesign.com/sitecore