90 likes | 223 Views
KnockoutJs and ASP.NET MVC. Get where you’re going. Roberto Hernández Managing Consultant Excella Consulting. Agenda. Who am I? What is KnockoutJs ? Concepts / Benefits? (1) Demo - Before there was Knockout! (2) Demo – KnockoutJs MVVM Pattern Observables Observable Arrays
E N D
KnockoutJs and ASP.NET MVC Get where you’re going. Roberto HernándezManaging ConsultantExcella Consulting
Agenda • Who am I? • What is KnockoutJs? Concepts / Benefits? • (1) Demo - Before there was Knockout! • (2) Demo – KnockoutJs • MVVM Pattern • Observables • Observable Arrays • Computed Observables (aka Dependent Observables) • Declarative Bindings • Templates • (3) Demo - Interacting with ASP.NET MVC 3.0
What is KnockoutJs? • Knockout is a JavaScript library that helps you to create rich, responsive display and editor user interfaces with a clean underlying data model. Any time you have sections of UI that update dynamically (e.g., changing depending on the user’s actions or when an external data source changes), KO can help you implement it more simply and maintainably. http://knockoutjs.com/
Features (Key Concepts) • Declarative Bindings • Easily associate DOM elements with model data using a concise, readable syntax • Automatic UI Refresh • When your data model's state changes, your UI updates automatically • Dependency Tracking • Implicitly set up chains of relationships between model data, to transform and combine it • Templating • Quickly generate sophisticated, nested UIs as a function of your model data http://knockoutjs.com/
Observer Pattern • Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. http://en.wikipedia.org/wiki/Observer_pattern
MVVM Pattern • Design pattern for building user interfaces. It describes how you can keep a potentially sophisticated UI simple by splitting it into three parts: • Model: your application’s stored data. This data represents objects and operations in your business domain are independent of the UI. • ViewModel: pure-code representation of the data and operations on a UI. For example, if you’re implementing a list editor, your view model would be an object holding a list of items, and exposing methods to add and remove items. • View: a visible, interactive UI representing the state of the view model. When using KO, your view is simply your HTML document with declarative bindings to link it to the view model. http://knockoutjs.com/
Code, Code, Code • Demos, Demos and more Demos.
Resources • http://www.asp.net/mvc • http://www.knockoutjs.com • http://blog.stevensanderson.com/
Thank You! • Blog: http://www.OverrideThis.com • Twitter: hernandezrobert • Email: • roberto.hernandez@excella.com • Code: • https://bitbucket.org/rhp_74/overridethis.knockoutjs