SlideShare a Scribd company logo
Building Single Page Apps
with DurandalJS
@kennethtruyers
www.kenneth-truyers.net
What is a Single Page App?
Web app that fits on a single page. It provides
fluent UX by loading all necessary data on
page load and then fetch progressively
Why should I build a SPA?
• Reach
• Devices, platforms, browsers
• Rich user experience
• Fluent pages through client-side navigation
• Reduced round tripping
Common traits
• Deep client-side linking
• Load what’s needed on page-load
• Progressively download when required
• Easy state maintenance
Demo: application overview
Presenting DurandalJS
AMD (Module loading) Data binding
DOM manipulation
Architecture
Client Server
REST
CSS
RequireJS Knockout jQuery Bootstrap
Views (HTML)ViewModels (JS)
Durandal
…
Demo: application code
Key concepts
• Modularization
• Routing
• Binding
• Composition
• Lifecycle & Promises
Modularization with RequireJS
define(['jquery', 'knockout'],
function ($, ko) {
var loaddata = function() {
$.ajax( ...);
};
var name = "myname";
return {
activate: loaddata,
name: name
};
});
AMD wrap
Dependencies
Private
Public interface
Demo: Modularization
Routing
• Client-side routing
• Deep linking
• URL parameters
• Route configuration
Demo: routing
Binding with Knockout
• Three binding types
• Simple properties
• ObservableArrays
• Computed
Demo: binding
Composition
• Object composition
• RequireJS and Module loading
• Visual composition
• Durandal feature
• Compose views + viewmodels inside other views
Demo: Composition
Lifecycle & promises
• Every page has “hooks” we can use to control behavior
• Lifecycle:
• Deactivation
• Activation
• Binding
• Composition
Lifecycle & promises
• Deactivation
• canDeactivate()
• deactivate()
• Activation
• canActivate()
• activate()
• Binding
• binding()
• bindingComplete()
• Composition
• attached()
• compositionComplete()
• detached()
Demo: Lifecycle & promises
Durandal: overview
• Modularization
• Routing
• Binding
• Composition
• Lifecycle & Promises
The future of Durandal
• Durandal + Angular  Merge into Angular 2.0
• Bringing strong suits of each framework together
Durandal + Angular merge
• Durandal
• Standardized module system
• Lifecycle & promises
• Composition
• Angular
• Web components through (improved)
directives
• Databinding
• Routing
• ES6 + modern browser
• Non backward-compatible
How to get it?
• Nuget
• Install-Package durandal
• Bower
• bower install durandal
• Mimosa
• mimosa skel:new durandal
• Raw downloads:
• durandaljs.com
• github.com/bluespire/durandal
• Visual Studio gallery: visualstudiogallery.msdn.microsoft.com
Links
• Demo application
• github.com/Kennethtruyers/DurandalDemos
• Docs & downloads
• durandaljs.com
• GitHub
• github.com/BlueSpire/Durandal
• Support
• Stackoverflow
• groups.google.com/forum/#!forum/durandaljs
Q & A
Ad

More Related Content

Similar to Building single page apps with Durandal js (20)

What Is Angular 2 | Angular 2 Tutorial For Beginners | Angular Training | Edu...
What Is Angular 2 | Angular 2 Tutorial For Beginners | Angular Training | Edu...What Is Angular 2 | Angular 2 Tutorial For Beginners | Angular Training | Edu...
What Is Angular 2 | Angular 2 Tutorial For Beginners | Angular Training | Edu...
Edureka!
 
The future of web development write once, run everywhere with angular.js and ...
The future of web development write once, run everywhere with angular.js and ...The future of web development write once, run everywhere with angular.js and ...
The future of web development write once, run everywhere with angular.js and ...
Mark Roden
 
The future of web development write once, run everywhere with angular js an...
The future of web development   write once, run everywhere with angular js an...The future of web development   write once, run everywhere with angular js an...
The future of web development write once, run everywhere with angular js an...
Mark Leusink
 
Module2
Module2Module2
Module2
Hoàng Lê
 
Creating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJSCreating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJS
Gunnar Hillert
 
Building enterprise applications on the cloud (Level 100)
Building enterprise applications on the cloud (Level 100)Building enterprise applications on the cloud (Level 100)
Building enterprise applications on the cloud (Level 100)
Prabath Fonseka
 
Mean stack
Mean stackMean stack
Mean stack
RavikantGautam8
 
6 weeks 6 months live project summer industrial training in cmc limited 2012
6 weeks  6 months live project summer industrial training in cmc limited  20126 weeks  6 months live project summer industrial training in cmc limited  2012
6 weeks 6 months live project summer industrial training in cmc limited 2012
CMC Limited
 
Comparing Angular and React JS for SPAs
Comparing Angular and React JS for SPAsComparing Angular and React JS for SPAs
Comparing Angular and React JS for SPAs
Jennifer Estrada
 
Microservices in Azure
Microservices in AzureMicroservices in Azure
Microservices in Azure
Doug Vanderweide
 
Angular js
Angular jsAngular js
Angular js
Radheshyam Kori
 
Angular js
Angular jsAngular js
Angular js
Radheshyam Kori
 
Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jiban
Jibanananda Sana
 
From desktop to the cloud with forge
From desktop to the cloud with forgeFrom desktop to the cloud with forge
From desktop to the cloud with forge
fpm2015
 
Angular js
Angular jsAngular js
Angular js
Manav Prasad
 
Angular patterns
Angular patternsAngular patterns
Angular patterns
Premkumar M
 
Forge - DevCon 2016: From Desktop to the Cloud with Forge
Forge - DevCon 2016: From Desktop to the Cloud with ForgeForge - DevCon 2016: From Desktop to the Cloud with Forge
Forge - DevCon 2016: From Desktop to the Cloud with Forge
Autodesk
 
Server rendering-talk
Server rendering-talkServer rendering-talk
Server rendering-talk
Daiwei Lu
 
AngularJS.pptx
AngularJS.pptxAngularJS.pptx
AngularJS.pptx
ssusera120f8
 
SOA 11g Foundation - G - ADF Development.ppt
SOA 11g Foundation - G - ADF Development.pptSOA 11g Foundation - G - ADF Development.ppt
SOA 11g Foundation - G - ADF Development.ppt
SudhirSinghShakyaVan
 
What Is Angular 2 | Angular 2 Tutorial For Beginners | Angular Training | Edu...
What Is Angular 2 | Angular 2 Tutorial For Beginners | Angular Training | Edu...What Is Angular 2 | Angular 2 Tutorial For Beginners | Angular Training | Edu...
What Is Angular 2 | Angular 2 Tutorial For Beginners | Angular Training | Edu...
Edureka!
 
The future of web development write once, run everywhere with angular.js and ...
The future of web development write once, run everywhere with angular.js and ...The future of web development write once, run everywhere with angular.js and ...
The future of web development write once, run everywhere with angular.js and ...
Mark Roden
 
The future of web development write once, run everywhere with angular js an...
The future of web development   write once, run everywhere with angular js an...The future of web development   write once, run everywhere with angular js an...
The future of web development write once, run everywhere with angular js an...
Mark Leusink
 
Creating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJSCreating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJS
Gunnar Hillert
 
Building enterprise applications on the cloud (Level 100)
Building enterprise applications on the cloud (Level 100)Building enterprise applications on the cloud (Level 100)
Building enterprise applications on the cloud (Level 100)
Prabath Fonseka
 
6 weeks 6 months live project summer industrial training in cmc limited 2012
6 weeks  6 months live project summer industrial training in cmc limited  20126 weeks  6 months live project summer industrial training in cmc limited  2012
6 weeks 6 months live project summer industrial training in cmc limited 2012
CMC Limited
 
Comparing Angular and React JS for SPAs
Comparing Angular and React JS for SPAsComparing Angular and React JS for SPAs
Comparing Angular and React JS for SPAs
Jennifer Estrada
 
Introduction to node.js by jiban
Introduction to node.js by jibanIntroduction to node.js by jiban
Introduction to node.js by jiban
Jibanananda Sana
 
From desktop to the cloud with forge
From desktop to the cloud with forgeFrom desktop to the cloud with forge
From desktop to the cloud with forge
fpm2015
 
Angular patterns
Angular patternsAngular patterns
Angular patterns
Premkumar M
 
Forge - DevCon 2016: From Desktop to the Cloud with Forge
Forge - DevCon 2016: From Desktop to the Cloud with ForgeForge - DevCon 2016: From Desktop to the Cloud with Forge
Forge - DevCon 2016: From Desktop to the Cloud with Forge
Autodesk
 
Server rendering-talk
Server rendering-talkServer rendering-talk
Server rendering-talk
Daiwei Lu
 
SOA 11g Foundation - G - ADF Development.ppt
SOA 11g Foundation - G - ADF Development.pptSOA 11g Foundation - G - ADF Development.ppt
SOA 11g Foundation - G - ADF Development.ppt
SudhirSinghShakyaVan
 

Recently uploaded (20)

AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
AI EngineHost Review: Revolutionary USA Datacenter-Based Hosting with NVIDIA ...
SOFTTECHHUB
 
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdfComplete Guide to Advanced Logistics Management Software in Riyadh.pdf
Complete Guide to Advanced Logistics Management Software in Riyadh.pdf
Software Company
 
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-UmgebungenHCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
HCL Nomad Web – Best Practices und Verwaltung von Multiuser-Umgebungen
panagenda
 
Generative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in BusinessGenerative Artificial Intelligence (GenAI) in Business
Generative Artificial Intelligence (GenAI) in Business
Dr. Tathagat Varma
 
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
AI Changes Everything – Talk at Cardiff Metropolitan University, 29th April 2...
Alan Dix
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
Big Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur MorganBig Data Analytics Quick Research Guide by Arthur Morgan
Big Data Analytics Quick Research Guide by Arthur Morgan
Arthur Morgan
 
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
#StandardsGoals for 2025: Standards & certification roundup - Tech Forum 2025
BookNet Canada
 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
 
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Enhancing ICU Intelligence: How Our Functional Testing Enabled a Healthcare I...
Impelsys Inc.
 
Ad

Building single page apps with Durandal js

Editor's Notes

  • #2: Who has built a SPA?What frameworks are we using?
  • #3: Single pages apps is a bad nameMeans single server loadMultiple client side pages (or screens)UX is all on the clientNot business, not security
  • #5: For a web app, traditional server side does not make sense anymoreThink of it as an app more then a web siteExample: phone application which fetches screens instead of data from an API
  • #6: Demo 1:Show simple applicationShow page logsShow network traffic
  • #8: Durandal is a framework of frameworksCoordinates different partsServer agnosticRest or XML or …
  • #9: Show code Views & ViewModelsShell
  • #10: ModularizationFixing JS “global”RoutingDeep linkingBackward navigationBindingSolving DOM manipulationCompositionObject & view composition, user controls, …Lifecycle & promisesLike an app  asynchronous hooks
  • #11: Information hiding (global)SOLID:Separation of concernsSingle responsibilityInversion of controlTesting: easy mockingOne module per file
  • #12: Show how pages are separated by requireJSmodulesShow how pages get loaded incrementallyNot only views, also modulesShow module configurationsAdd toastr to projectdetails.
  • #13: Fluid navigationSharing URL’s, bookmarking
  • #14: Get changeset “Added Toastr to projectdetail”Show deep linkingShow route configurationShow route binding in shellAdd about pageGet changeset “Include detail page”Add contributors detail
  • #15: Solving DOM access problemsDeclarative mark-up
  • #16: Get changeset “Added routing for contributor detail page”Show simple data binding on About Page (title)Add valueupdate: ‘afterkeydown’Get changeset “Added simple observable”Show Computed on contributor detail (firstname + lastname)View: col-xs-10  form  label, input[data-bind=value: FirstName]ViewModel: Include observable pluginobservable.defineProperty(self, 'FullName', function() { return self.contributor.FirstName + ' ' + self.contributor.LastName;});Get changeset “added computed observable”Show observable array on projects pageView: <a href="#" data-bind="click: $parent.removeProject">Remove</a>ViewModel:self.removeProject = function(project) {self.projects.remove(project);};
  • #18: Show shellGet changeset “Added composition module”Show adding user control inside project detail(emptyContrib)(contribList)Show how this can be done by observing the name variable observable(viewModel, 'firstName').subscribe(function(value){ });
  • #21: Show activation promise in projects.jsShow example withsetTimeoutShow cancelling page navigation in projectdetail.jsShow returning true / falseShow returning promise Require ‘plugins/dialog’self.canDeactivate = function() { return dialog.showMessage("Are you sure?", "Do you want to leave?", ["Yes", "No"]); };
  • #22: ModularizationFixing global issuesRoutingDeep linkingBackward navigationBindingSolving DOM manipulationSeparation of logic / viewsCompositionObject & view composition, user controls, …Lifecycle & promisesLike an app  asynchronous hooks
  • #24: If you need to choose now: Durandal or Angular  does not matter since they will both have an upgrade path to Angular 2.0