Шаблон Partials в подчеркивании (как в руле)?
У меня есть модель позвоночника, как это
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"
}
});
И ниже мои шаблоны
<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>
Вот как я реализовал частичное использование handlebars.js.
Мои вопросы
1.Do we have similar thing, I mean the partials incase of underscore.js template engine?
2.If so how do we implement partial in underscore.js template engine