Sample example for KnockoutJS:
We can start Knockout js with below small example.Below example will helpful to use Knockout js. Before start the knockout js download JS file from following path
1. http://knockoutjs.com/downloads/knockout-3.4.0.js (OR)
2. Use folowing CDN url http://ajax.aspnetcdn.com/ajax/knockout/knockout-3.1.0.js
Sample Code:data-bind – It will helpfull to bind the values from ViewModel to HTML element
name & age – It will refer the ViewModel variable.
ko.observable – It will helpfull to update the values whenever user change the value from the fields.
ko.computed – This is method of our ViewModel , so whenever changes is done by the user from name & age filed these will update the output automatically.
CORNER OF BLOG: