Does the underscore.js template support objects within objects?
For instance, I have an object rendered such as below:
var person = new Person([
{name: 'Allen', pet:[ name: 'fido', type: 'dog']},
{name: 'Chris', pet:[ name: 'garfield', type: 'cat']}
]);
<script type="text/template" id="template">
<%=name%> has a pet named <%= ??? %>
</script>
What do I put in place of the ??? in order to get the name of the pet?
Note: I've tried pet.name and pet[name], but both don't work. Out of ideas!
pet:([name: 'fido' type: 'dog'])can't it be justpet:[name: 'fido' type: 'dog']? Also whynew Object?objectis almost a reserved word