Modelo parcial no sublinhado (assim como no guidão)?
Eu tenho um modelo de backbone como este
var PeopleModel = Backbone.Model.extend({
defaults: {
"people": [
{ "username": "alan", "firstName": "Alan", "lastName": "Johnson", "phone": "1111", "email": "[email protected]" },
{ "username": "allison", firstName: "Allison", "lastName": "House", "phone": "2222", "email": "[email protected]" },
{ "username": "ryan", "firstName": "Ryan", "lastName": "Carson", "phone": "3333", "email": "[email protected]" },
{ "username": "ed", "firstName": "Edward", "lastName": "Feild", "phone": "4444", "email": "[email protected]" },
{ "username": "phil", "firstName": "Philip", "lastName": "Doom", "phone": "5555", "email": "[email protected]" },
{ "username": "gerald", "firstName": "Gerald", "lastName": "Butler", "phone": "6666", "email": "[email protected]" }
],
"company": {"name": "Random Corp."},
"country": "England"
}
});
E abaixo estão meus modelos
<script id="people-template" type="text/x-handlebars-template">
{{#each people}}
{{> person}}
{{/each}}
</script>
<script id="person-partial" type="text/x-handlebars-template">
<div class="person">
<h2>{{fullName}} </h2>
<div class="phone">{{phone}}</div>
<div class="email"><a href="mailto:{{email}}">{{email}}</a></div>
</div>
Foi assim que implementei parcialmente usando o handlebars.js.
Minhas perguntas
1. Nós temos algo parecido, quero dizer, os partials encaixam no mecanismo de template underscore.js?
2.Se como implementamos o mecanismo de modelo partial in underscore.js