Book Image

WEB APP TESTING USING KNOCKOUT.JS

By : Roberto Messora
Book Image

WEB APP TESTING USING KNOCKOUT.JS

By: Roberto Messora

Overview of this book

Table of Contents (11 chapters)

Data-binding in detail


The main objective of a web application is to present some data and eventually react to user inputs. In the previous sections, you learned that the Model-View-ViewModel strategy is to hold the data (the Model) and commands in a pure-code representation of the View called ViewModel. We also briefly scratched the surface of the data-binding mechanism that permits the connection between the ViewModel and HTML markup.

In this section, we will review the Knockout.JS built-in data-binding types. There are many ways to present information on a web page. There are plenty of elements in HTML that need a way to bind the ViewModel properties and commands.

The data-binding syntax

In Knockout.JS, we talk about declarative data-binding because we need to place the data-bind attributes inside the HTML tags, and specify what kind of binding is associated to a ViewModel property/command.

The attribute value must follow a specific syntax in order to allow Knockout.JS to decode its content...