- Declarative bindings: (Easily associate DOM elements with model data using a concise, readable syntax);
- Automatic UI Refresh: (When your data model’s state changes, your UI updates automatically)
- Dependency tracking: (Implicitly set up chains of relationships between model data, to transform and combine it)
- Templating: (Quickly generate sophisticated, nested UIs as a function of your model data)
In the example below I use jQuery to get some json server data.
The Json server data should be an array of objects containing a ‘value’ and ‘text’ property. As you can see I use the ‘html5’ ‘data-bind attribute’ to map my view model to my UI elements.
For example your ASP.NET MVC3 action could look like this.
public JsonResult States(string country)
I wrote the examples in notepad, so there could be some issues. However if I did my job well this should be all to let all the magic happen.
If you like it share it! If you don’t share it!