سؤال

What factors should I consider before adopting the Knockout JavaScript library for my application?

Currently I have a ASP.NET MVC 2 site. Most of the navigation and set up of the site is simple get and post actions. There are views which have grids / multiple grids where the data is view only. All the ajax and javascript is being handled using JQuery. JSON returned from Controllers are few and sparsely used. Most of the ajax grids are implemented by sending HTML using partial views.

هل كانت مفيدة؟

المحلول

There are many factors but one thing which i've found very helpful:

When you have UI elements which are to be updated AND are sporadically distributed in your webpage e.g. When you want to add a new job experience, want to show the notification of successful addition on top of the page and increase the count somewhere on the right menu etc. If you use MVC ajax helpers then you would need to specify a single element which needs to be updated with ajax content or write your own huge jQuery.ajax thing. Knockout really simplifies this scenario.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top