Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : Live binding to an array inside an object

$
0
0
Note.. I use Mootools so my code may be slightly different than what you need.

Your template looks like this:
  1. <% Array.each(this.attr("pets"), function(pet, index) { %>
  2. <span <%= (el) -> can.data(el, "pet", index) %>><%= pet %></span>
  3. <% }); %>
If span is an input, you also have to do some trickery in the controller to bind value changes. This is why I store the index of the pet in the elements data.

Viewing all articles
Browse latest Browse all 3491

Trending Articles