0
у меня Вид:Скомпилированная Handlebar шаблон не делает
var ProductsView = Backbone.View.extend({
initialize: function(){
var that = this;
this.collection.fetch({
success: function()
{
console.log("fetcheo");
that.render();
}
});
this.listenTo(this.collection, "reset", this.render);
},
render: function(){
var cats = [];
this.collection.each(function(model)
{
cats.push(model.get('familia'));
});
this.cats = _.uniq(cats, false);
console.log(this.cats) // It returns ["VINOS", "CERVEZA", "BOTANA"]
this.$el.html(Handlebars.templates.products(this.cats));
return this;
}
});
И это предкомпилированный шаблон Handlebar:
<h1>Y LOS MODELOS SON</h1>
<ul>
{{#each cats}}
<li>
{{this}}
</li>
{{/each}}
</ul>
Но он не оказал массив this.cats; Это не проблема с коллекцией() Я уже исправил раннюю проблему с этим. Спасибо за помощь ...
спасибо большое !!!! –