javascript - backbone.js escaping html -
im pulling html database display on page using backbone.js
the data stored this
<p> test</p> <p>test 1</p> <p>test 2</p>
in page when using underscore.js
pp<%= title %>
<%= maincontent %>
</div> </div> </script> <!-- sample template pagination ui --> <scripttype="text/html" id="tmpserverpagination">
<% if (currentpage < totalpages) { %> <a href="#" class="btn long servernext">show more</a> <% } %> </div> </script>
it renders
test
test 1
test 2
where want read tags , apply formating page
test test 1 test 2
this view
( function ( views ){
views.resultview = backbone.view.extend({ tagname: 'li', template: _.template($('#resultitemtemplate').html()), initialize: function() { this.model.bind('change', this.render, this); this.model.bind('destroy', this.remove, this); },
render : function () { this.$el.html(this.template(this.model.tojson())); return this; } });})(app.views);
if you're trying display paragraphs inline, use:
p { display: inline-block; }
you'll want namespace (e.g. .pagination p) doesn't affect paragraphs on page.
Comments
Post a Comment