HTML and CSS Reference
In-Depth Information
your camelcased-singular product model is accessible at the underscored-
pluralized /products path, with instances of the resource accessible at /products/:id. You
can override these path defaults by assigning either a string or a function-returning a-
string to the url property of your model class (for the collection path) or to the prototype
(for the member path). For example:
class Product extends
Batman . Model
@persist Batman . RestStorage
@url = "/admin/products"
url: -> "/admin/products/ #{ @id } "
Knockout
Knockout.js is built around three core features:
• Observables and dependency tracking
• Declarative bindings
• Templating
Knockout is designed to allow the use of arbitrary JavaScript objects as viewModel s. As
long as some of your viewModel 's properties are observables, you can use Knockout to
bind them to your UI, and the UI will be updated automatically whenever the observable
properties change. Figure 4-15 shows Knockout to have a good following of users and
commit logs are active.
Figure 4-15. Knockout github stats, June 2012
For a full demo on how to use Knockout's server synchronization, view
this tutorial .
Knockout server synchronization. Observables are declared on model properties. They
allow automatic updates to the UI when the model changes:
var viewModel = {
serverTime : ko . observable (),
numUsers : ko . observable ()
}
 
Search WWH ::




Custom Search