I have the following template in my index.jade:
....
<script type="text/template" id="sample-template">
a(href="<%= link.href %>") <%= link.title %>
</script>
....
And I have the below code in my backbone view which sends a variable called link to index.jade.
....
var SampleView = Backbone.View.extend({
template: _.template($('#sample-template').html()),
render: function() {
this.$el.append(this.template({
link: this.model.toJSON()
}));
return this;
}
});
....
Now when I render that template I get the following output:
<a href="<%= link.href %>"> sample link
You see, I got the correct output for title variable. But the problem is with href. It doesn't print the value of link.href.
Aucun commentaire:
Enregistrer un commentaire