I'm trying to create live binding to an array inside an object.
- var obj = {
- name : "Steve Doe",
- age : 35,
- pets : [cat, dog, fish, rabbit ]
- }
I have live binding working great for name and age as such...
- <span class='name'><%= this.attr('name') %></span>
- <span class='name'><%= this.attr('age') %></span>
but I run into issues when I try to insert the pets, because I lose reference to anything that has an .attr() method.
- <% this.pets.each(function(pet){
- <span><% //how to I reference pet here with .attr()??? %> </span>
- <% } %>
The parameter to the each 'pet' is just a string, so I can't figure out how to .attr() it.
Help? Thanks!