【发布时间】:2013-09-08 04:14:54
【问题描述】:
我使用backbone.js从我的数据库中提取html以显示在我的页面上
数据是这样存储的
测试
测试1
测试2
使用 underscore.js 时在我的页面中
pp
</div> </div> </script> <!-- sample template for pagination UI --> <scripttype="text/html" id="tmpServerPagination">
<% if (currentPage < totalPages) { %> <a href="#" class="btn long servernext">Show More</a> <% } %> </div> </script>
它呈现
测试
测试 1
测试 2
我希望它在哪里读取标签并将格式应用于页面
测试 测试 1 测试 2
这是我的看法
(函数(视图){
views.ResultView = Backbone.View.extend({ 标记名称:'李', 模板:_.template($('#resultItemTemplate').html()), 初始化: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);
【问题讨论】:
-
想从字符串中删除html标签?
标签: javascript jquery html backbone.js