This can be extremely useful in several different situations. Where we had been creating objects and manually defining each property as observable, the mapping plugin will do this automatically.
In Example 9-1, I convert an example from Chapter 3 that demonstrates the
with binding on a single
book object. In the original example, a
book object is passed to the
ViewModel via the constructor. This is then directly assigned to the internal
book property and used for displaying with Knockout bindings. However, because it is using the mapping plugin, all of the properties (
publishedDate) are now being observed.
<title>Data Binding with KnockoutJS