Knockout is an open source JavaScript library that lets you develop rich, interactive, and modular web applications. It does this in a manner that reduces complexities of JavaScript and HTML development and allows us to develop highly scalable, testable, and maintainable web applications.
Knockout provides the ability to bind HTML elements to a data model. The binding is two-way, which means that any change to the data is reflected in the HTML elements and any change to the HTML elements is reflected in the data. Knockout implements two-way binding using the Model-View-View Model (MVVM) design pattern. You will learn more about this pattern in the next section.
Knockout is a pure JavaScript library and is not dependent on other low-level JavaScript libraries such as jQuery or Prototype. Libraries such as jQuery can be used in conjunction with Knockout to provide richer features to your application such as making AJAX calls, providing animation to HTML elements, or providing event handling for custom user interface components.
Knockout supports all major browsers. A list of supported browsers can be found on the Knockout's website at http://knockoutjs.com/.
This chapter covers the following topics:
Understanding the MVVM design pattern: We will explore the MVVM pattern and how it is implemented using knockout.js
Key features of Knockout: We will look at the key features of knockout.js
Understanding the module pattern: We will explore the module pattern and see how it can be used to give structure to your Knockout application
Building your first application: We will build the first application and learn where to download knockout.js from and how to set up the development environment
Defining data model and applying data bindings: We will also learn the basics of defining the data model and applying data bindings
Applying styles to our application using Bootstrap
Taking a look at some useful resources