HTML and CSS Reference
In-Depth Information
This automatically creates observable properties for each of the properties on data.
Then, every time you receive new data from the server, you can update all the properties
on
viewModel
in one step by calling the
ko.mapping.fromJS
function again:
// Every time data is received
from
the
server
:
ko
.
mapping
.
fromJS
(
data
,
viewModel
);
All properties of an object are converted into an observable. If an update would change
the value, it will update the observable.
Arrays are converted into observable arrays. If an update would change the number of
items, it will perform the appropriate add or remove actions. It will also try to keep the
order the same as the original JavaScript array.