Knockout js with mvc

Preview:

DESCRIPTION

 

Citation preview

KnockoutJS with ASP.NET MVCJOEL COCHRAN

About Me

Expression Blend MVP

ASPInsider Manager Consultant, Sogeti

joelcochran@gmail.com

@joelcochran

joelcochran.com

Windows 8 apps with HTML5 and JavaScript

manning.com/shultz/

37% off!

Use promo code: win8app37

http://madexpo.us

KnockoutJS: MVVM for the web

Separation of concerns

Data binding

Uses modern HTML5

Pure JavaScript

Scripts we’ll use

jQuery – jQuery.com

Knockout – knockoutjs.com

Knockout mapping

All available through Nuget

Traditional ASP.NET MVC

Pros Strongly Typed Razor syntax (familiar)

Intellisense

Start with Templates

Cons Embedded JavaScript

Poor Intellisense

No separation

Stop! Demo time

Knockout Mapping

Fast and (almost) painless

Allows for separation

BUT

Ties Knockout ViewModel to ASP.NET ViewModel

Stop! Demo time

AJAX Calls within Controller

Flexible

Responsive

Performant

Can be done right in the Controller

Good and bad: Can clutter up your Controller

Stop! Demo time

AJAX calls outside the Controller

Service calls

True separation

Can be used in many applications/formats

ASP.NET MVC 4 has this built in with WebApi

Fits very well with the KO approach

Stop! Demo time

Thanks

joelcochran@gmail.com

@joelcochran

joelcochran.com

Recommended