I have the following template:
<a href="{{test_url}}>Test</a>
But it doesn't work, instead the {{}} becomes html enco开发者_运维知识库ded in the output.
How do I prevent this?
Assuming you are using the default templating engine that comes with Backbone.js (which actually comes from Underscore.js), then the syntax would be:
<a href="<%= test_url %>">Test</a>
Assuming that test_url
exists in the data object you are passing to the template. Also, make sure that you are passing a plain old JS object (this.model.toJSON()
) to the template function or else the resolution won't happen.
If it turns out you are using a different templating engine, please let us know what engine it is AND provide us with the view code that is rendering the template.
精彩评论