Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Disclaimer</strong> : This answer was written for Rivets.js &lt; 0.5. If you're using 0.6 or greater, please see the current documentation for adapters instead.</p> <p><a href="http://rivetsjs.com/#adapters" rel="nofollow">http://rivetsjs.com/#adapters</a></p> <hr> <p>The <code>.</code> notation uses the adapter to subscribe to the model for changes on a particular attribute. Since you haven't specified an adapter, Rivets.js doesn't know how to read or subscribe to the model for changes. See <a href="http://rivetsjs.com/#configure" rel="nofollow">http://rivetsjs.com/#configure</a>.</p> <p>The <code>:</code> notation bypasses the adapter and reads the property directly on the model. This is a read-only operation and doesn't perform any further data binding. Without defining an adapter, this is really all you can do and doesn't provide much benefit over static templating unless paired with dependencies or is in the context of an iteration (an adapter is needed to do either of those).</p> <p>You don't mention any framework or events library that you're using, and from your example you are trying to bind to a plain JavaScript object. Typically, Rivets.js is used alongside another library that provides change events for your models such as <a href="http://backbonejs.org/" rel="nofollow">Backbone.js</a> or <a href="http://www.helgoboss.org/projects/iota-observable/" rel="nofollow">Iota Observable</a>. This is because current browsers don't have the ability to observe plain JavaScript objects for changes... yet... (See <a href="http://wiki.ecmascript.org/doku.php?id=harmony%3aobserve" rel="nofollow">Object.observe proposal</a>).</p> <p>I'd recommend using one of those libraries alongside Rivets.js, but if you're totally set on using plain JavaScript objects, you can look at using something like <a href="https://github.com/melanke/Watch.JS" rel="nofollow">Watch.js</a> or an <a href="https://github.com/KapIT/observe-shim/" rel="nofollow">Object.observe shim</a>. Either way, you need to define an adapter.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload