Teilvorlage im Unterstrich (genau wie beim Lenker)?
Ich habe ein solches Backbone-Modell
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"
}
});
Und unten sind meine Vorlagen
<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>
So habe ich teilweise mit handlebars.js implementiert.
Meine Fragen
1.Haben wir eine ähnliche Sache, ich meine die partials incase von underscore.js Template Engine?
2.Wenn ja, wie implementieren wir teilweise in die Template-Engine von underscore.js?