Today I was looking into Knockout JavaScript library and its features. Now I want to use this with MVC 3 applications but What is the benefits to use this with MVC 3?
Today I was looking into Knockout JavaScript library and its features. Now I want
Share
Knockout is an MVVM pattern that works with a javascript ViewModel. The reason this works well with MVC is that serialization to and from javascript models in JSON is very simple.
Also, it will be included in MVC4. Here is a video by the Knockout creator on how to use it for single page applications in MVC4 (with Microsoft’s new Web API feature):
http://channel9.msdn.com/Events/TechDays/Techdays-2012-the-Netherlands/2159
But the benefits are really that MVVM allows you to develop rich UI’s with a lot less coding (if you are familiar with Silverlight or WPF MVVM you’ll know just what I mean).
Given a ViewModel of:
You do not need to bind
and the reverse of
all over the place, or special code handling of computed properties in your view in Knockout. You can do it all in a very nice object oriented fashion.
And all the events are wired up.