What is Model?
Model is your business entity like User,Customer objects which contains property.
What is ViewModel:
Viewmodel looks like Model but it contains behavior
Let's create a simple hello world example using knockout.js.Create a html file named index.html and add following code
In the above code,first I have added refrence of knockout.js and then created two html controls input and span.Notice the markup on line 8 and 9 We are using a new attribute: data-bind.
data-bind is knockout syntax for binding viewmodel property to view.
On line 10 to 14 I have created a simple viewmodel which have one singal property message with default value "Hello World".
On line 15 I am attaching viewmodel to view