Reputation: 2148
I´m using underscore to load a html template with by require.js with text.js, like code bellow:
template: _.template(listItemTemplate)
, render: function () {
$(this.el).html(this.template(this.model.toJSON));
return this;
}
tvListItemTemplate.html
<h4><%= _id%></h4>
If i do console.log(this.model.toJSON()) it prints the following:
But the console give me this error:
I don´t understand why
Upvotes: 0
Views: 144
Reputation: 2148
Sorry for that but it was a own stupid error in:
$(this.el).html(this.template(this.model.toJSON()));
Upvotes: 0
Reputation: 5895
Check with:
$(this.el).html(_.template(listItemTemplate, this.model));
or
template: function(x) {
_.template(listItemTemplate, x);
},
render: function () {
$(this.el).html(this.template(this.model));
return this;
}
Upvotes: 1