What is Knockout and Why to use it ?
Knockout JavaScript :
Knockout.js is JavaScript framework which allow us to implement MVVM (Model View View-Model) UI pattern in JavaScript and HTML.
Knockout.js is a pure JavaScript library with no external dependencies. It is supported on all major browsers, IE 6+, Firefox 2+, Chrome, Opera, Safari (desktop/mobile).
There are many other libraries are available on the internet which providing us the same functionalists then why we should use it ?
- Its providing two way binding (b/w View and ViewModel) .Once you have setup the correct binding everything just works because of two way binding.
 - Number of lines of Javascript you have to write is very small.
 - Documentation is easy to understand
 - Descriptive syntax
 - Providing other useful utilities too
 
Knockout are very specific about their concepts :
- Declarative binding : To bind element with viewmodel ,knockout is using data- attribute of HTML5 . syntax they have used for binding are very descriptive .
 - Automatic UI refresh : Once you have setup the correct binding everything just works automatically because of two way binding.
 - Dependency Tracking : we can bind viewmodel properties to DOM elements in conjunction with no problem.knockout take care all the dependency of model binding to the elements.
 - Templating : knockout providing us some control flow like( foreach ,with) and JavaScript based templating to quickly generates the sophisticated UI .Example : (we can quickly generate a list of user with username ,which are bind to our model using any iterating technique(jquery template,knockout native template)).
 
Thanks fr reading :) :) .


0 comments:
Post a Comment