Building HTML and JavaScript Apps with KnockoutJS and MVVM DEV361.

Slides:



Advertisements
Similar presentations
SharePoint and Knockout for the REST of Us
Advertisements

Microsoft Exchange Server 2010 SP2 Tips & Tricks Scott Schnoll Principal Technical Writer Microsoft Corporation EXL305_R.
What’s New in Windows Communication Foundation in Microsoft.NET 4.5 Daniel Roth Senior Program Manager Microsoft Corporation DEV326.
Another look at Knockout JS By Peter Messenger Senior Developer – Triple Point Technology
Identify & Fix Performance Problems with Visual Studio 2012 Ultimate Benjamin Day Benjamin Day Consulting, Inc. benday.com/blog
Upgrading SSIS Packages to SQL Server 2012 Sven Aelterman Lecturer in Information Systems & Web/Technology Specialist Troy University, Sorrell College.
Creating Robust, Maintainable Coded UI Tests with Visual Studio 2012 Eric Maino Senior Developer Microsoft Corporation DEV312.
WSV304 Manual Deployment High cost Fully Automated Low cost.
What's New in Microsoft Deployment Toolkit 2012 Michael Niehaus Senior Program Manager Microsoft Corporation.
Introducing the New Visual Studio 2012 Unit Testing Experience Peter Provost Sr. Program Manager Lead Microsoft Corporation DEV214.
Working on an Agile Team with Visual Studio 2012 and Team Foundation Server 2012 Peter Provost Sr. Program Manager Lead Microsoft Corporation DEV318.
Knockoutjs and JQuery The One-Two Punch for Richer MVC 4 Applications Connecticut.NET Developers Group November 13, 2012.
Deploying Windows 8 with MDT: A Preview Michael Niehaus Senior Program Manager Microsoft Corporation.
Introducing the New Visual Studio 2012 Unit Testing Experience Peter Provost Sr. Program Manager Lead Microsoft Corporation DEV214.
Troubleshooting Windows 7 Deployments Michael Niehaus Senior Program Manager Microsoft Corporation.
Dev-Ops Best Practices on the Microsoft Stack Victor Mushkatin Group Program Manager Microsoft Corporation DEV363.
Making Agile Estimation Work Joel Semeniuk and Stephen Forte AAP309.
Deep Dive into the Team Foundation Server 2012 Agile Planning Tools Gregg Boer Principal Program Manager Microsoft Corporation.
Visual Studio Tips & Tricks Dustin Campbell Microsoft Corporation Scott Cate EventDay.com DEV319.
Making the most of Search in Microsoft SharePoint Online Corey Roth Applications Architect Infusion OSP338.
Implementing Scrum Using Team Foundation Server Richard Hundhausen President, Accentient DEV212.
Implementing Team Foundation Server in the Enterprise: Guide to a Successful Implementation Jeff Levinson Solutions Architect The Boeing Company DEV343.
Building Windows 8 Apps for the Enterprise Robert Green Technical Evangelist Microsoft Corporation.
Optimizing Microsoft SQL Server Analysis Services for Big Data Adam Jorgensen Microsoft Corporation.
Dev-Ops Best Practices on the Microsoft Stack Victor Mushkatin Group Program Manager Microsoft Corporation DEV363.
Building Metro style UIs Paul Gusmorino Lead Program Manager Microsoft Corporation DEV354.
Knock the jQuery out! Bartosz
Microsoft Excel: A Web Development Tool? Steve Hansen Grid Logic OSP202.
Building Metro style apps with HTML and JavaScript Paul Gusmorino Lead Program Manager Microsoft Corporation.
Building Metro style apps with HTML and JavaScript Paul Gusmorino Lead Program Manager Microsoft Corporation.
Visual Studio Tips & Tricks Dustin Campbell Microsoft Corporation Scott Cate EventDay.com DEV319.
ASP.NET for Mobile and Tablet Development Damian Edwards Senior Program Manager Microsoft Corporation.
Visual C#/Visual Basic: Becoming a Guru with Existing Features Peter Ritchie Principle Peter Ritchie Inc. Software Consulting DEV325.
DPR305. Controller Model View Client Business Objects Server Business Objects Data.
Creating LOB Metro style Apps in XAML Using Blend and Visual Studio Jeffrey Ferman Program Manager Microsoft Corporation DEV369.
Paul D. Sheriff DEV216 MVVM Made Easy Paul D. Sheriff
Continuous Delivery of Windows Azure Cloud Services (DEV310) Paul Yuknewicz Principal Program Manager Lead, Visual Studio Microsoft.
Identify & Fix Performance Problems with Visual Studio 2012 Ultimate Benjamin Day Benjamin Day Consulting, Inc. benday.com/blog
Demystifying Team Foundation Server Builds Mickey Gousset Principal Consultant Infront Consulting Group DEV342.
What’s New in WF4.5 Dave Cliffe Program Manager Microsoft Corporation.
Real World Developer Testing with Visual Studio 2012 David Starr Chief Software Craftsman Scrum.org Peter Provost Program Manager Lead Microsoft AAP401.
JAVASCRIPT WITH A VIEW Jordan Knight Solution Architect Xamling SESSION CODE: WEB305 (c) 2011 Microsoft. All rights reserved.
Taking Control of Visual Studio through Extensions and Extensibility Anthony Cangialosi Senior Program Manager Lead Microsoft Corporation DEV311.
DEV351.
DEV321. demo Rule: Any slide about UX must be charcoal gray or black.
WCL328 - Windows Intune for the Enterprise David Nudelman Senior Consultant – Microsoft MVP OCSL - UK.
App Controller Tabrez Mohammed Yuan Zheng Program Managers Microsoft Corporation MGT303.
A Lap Around Windows Presentation Foundation (WPF) 4.5 Pete Brown | XAML and Gadget Guy Microsoft Corporation DEV335.
Cloud-Ready Data Services. cloud data services.
Advanced Microsoft SharePoint 2010 Upgrade Troubleshooting Shane Young – Todd Klindt SharePoint Nerds Rackspace OSP339.
ADO.NET Entity Framework 4.3 for Real Web Applications Adam Tuliper Software Architect Cegedim DEV215.
ASP.NET Loves HTML5 Damian Edwards Senior Program Manager Microsoft Corporation DEV303.
Introduction to Kanban Steven Borg, Northwest Cadence Co-founder and Strategist AAP204.
Async Made Simple in Windows 8, with C# and Visual Basic Alex Turner Program Manager VB/C# Compilers Microsoft Corporation DEV332.
Demystifying Forefront Edge Security Technologies – TMG and UAG Richard Hicks Director – Sales Engineering Celestix Networks, Inc. SIA208.
Going Beyond F11: Debug Better and Faster with Visual Studio 2012 Brian A. Randell Senior Consultant MCW Technologies DEV317.
KnockoutJs online Training at GoLogica in Pune
What web developers need to know when building Metro style apps
12/2/2018 4:10 AM © 2009 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered.
Using Windows Runtime and SDK to build Metro style apps
Deep Dive into the Team Foundation Server 2012 Agile Planning Tools
Advanced IntelliTrace in Production
DEV410: Deep Dive into Team Foundation Server 2012 Reporting
Building Awesome Metro style HTML apps in Blend
Integrating with Windows 8 Experiences
Building Business Applications in LightSwitch
Using Windows Runtime and SDK to build Metro style apps
Sayed Ibrahim Hashimi Program Manager Microsoft Corporation
Brandon Bray Principal Group Program Manager Microsoft Corporation
What’s New in Visual Studio LightSwitch
Presentation transcript:

Building HTML and JavaScript Apps with KnockoutJS and MVVM DEV361

UI Patterns Data & Bindings Data & Bindings Separation of Concerns Separation of Concerns Structured JavaScript Structured JavaScript

6+ 2+ Separates behavior and structure Declarative bindings Observables

Knockout in 3 Steps Declarative Binding var myViewModel = { firstName: ko.observable("John") }; ko.applyBindings(myViewModel); Create an Observable Bind the ViewModel to the View

Manual Push via jQuery Guitar model: Sales price: var product = { id: 1001, model: "Taylor 314ce", salePrice: }; $("#guitarModel").val(product.model); $("#guitarSalesPrice").val(product.salePrice); Source object Push from Source to Target

demo With and Without Knockout

Taylor 110 Taylor 914ce Taylor 110

2 Way Binding Guitar model: Sales price: Declarative Binding product: { id: 1001, model: ko.observable("Taylor 314ce"), salePrice: ko.observable( ) } ko.applyBindings(data); Source object Bind Source to Target, & Vice Versa

demo Observables

Defining a Computed vm = { id: ko.observable(1), salePrice: ko.observable(4199), qty: ko.observable(2) }; vm.extendedPrice = ko.computed(function () { return this.product() ? this.salePrice() * parseInt("0" + this.qty(), 10) : 0; }, vm); observables owner

demo Computed

Working with observableArray var myViewModel = { salesPerson: ko.observable("John"), empNum: ko.observable(39811), products: ko.observableArray([ { model: "Taylor 314CE", price: 1749, id=321 }, { model: "Martin D40", price: 1899, id=479 } ]) }; Pre-populating Operating on observableArray

demo ObservableArray

Built In Bindings <input type="text" data-bind="enable: allowEditing, value:salePrice" /> <select data-bind="options: colors, value: selectedColor, optionsText: 'name', optionsValue: 'key'" > Built into Knockout Binding for element attributes Multiple binding expressions

attrcheckedclickcssdisableenableevent hasfocus htmloptions optionsTextoptionsValue selectedOptionsstylesubmittextuniqueNamevalue visible text value click disable enable attr Display and state bindings Text and value bindings Bindings for specific attributes visible event Event bindings

demo Built In Bindings

If truthy condition if If falsy condition ifnot Execute for each item in a list foreach Shortcut to execute for the object with

Control of Flow with a Template Pass the context for the template with “foreach”...

Conditionals 0"> Total value: Any “truthy” expression

Changing Context

demo Control of Flow and Templates

All Part of the Native Template Engine in Knockout All Part of the Native Template Engine in Knockout

demo Templates

With and Without Knockout Observable Computed ObservableArray Built In Bindings Templates Custom Binding Handlers

Creating a Binding Handler ko.bindingHandlers.fadeVisible = { init: function(element, valueAccessor) { //... }, update: function(element, valueAccessor) { //... } Runs first time the binding is evaluated Runs after init and every time one of its observables changes

Common Parameters ko.bindingHandlers.fadeVisible = { init: function(element, valueAccessor, allBindingsAccessor, viewModel) { var shouldDisplay = valueAccessor(); $(element).toggle(shouldDisplay); }, update: function(element, valueAccessor, allBindingsAccessor, viewModel) { var shouldDisplay = valueAccessor(); shouldDisplay ? $(element).fadeIn() : $(element).fadeOut(); } Bound DOM element What is passed to the binding All other bindings on same element The viewmodel

demo Custom Binding Handlers

JavaScript: The Developer Experience (DEV308) Find Me Later JavaScript: The Language (DEV307)

Visual Studio Home Page :: Jason Zander’s Blog :: Facebook :: Twitter :: Somasegar’s Blog ::

Connect. Share. Discuss. Learning Microsoft Certification & Training Resources TechNet Resources for IT Professionals Resources for Developers

Required Slide Complete an evaluation on CommNet and enter to win!

Scan the Tag to evaluate this session now on myTechEd Mobile