backbone.js正在转义html
backbone.js escaping html
im从我的数据库中提取html,使用backbone.js 显示在我的页面上
数据存储方式类似于
<p>TEST<p>lt;p>测试1<p>lt;p>测试2<p>
在我的页面中使用underscore.js 时
pp<%=标题%>
<%=mainContent%>
</div> </div> </script> <!-- sample template for pagination UI --> <script
type="text.html"id="tmpServerPagination">
<% if (currentPage < totalPages) { %> <a href="#" class="btn long servernext">Show More</a> <% } %> </div> </script>
它呈现
测试
我想让它读取标签并将格式化应用到页面
试验测试1测试2
这是我的观点
(功能(视图){
views.ResultView=Backbone.View.extend({tagName:"li",template:_.template($('#resultItemTemplate').html()),initialize:function(){this.model.bind('change',this.render,this);this.model.bind('destroy',thisremove,this);},
render : function () { this.$el.html(this.template(this.model.toJSON())); return this; } });
})(app.views);
如果您只是想以内联方式显示段落,那么您可以使用:
p {
display: inline-block;
}
您可能需要为其命名名称(例如.pagination p
),这样它就不会影响页面上的所有段落。
相关文章:
- 将c#视图模型转换为javascript模型时转义HTML标记
- Regex以转义HTML标记
- 需要使用Java编码/转义HTML字符串,并在JavaScript中解码HTML字符串
- 如何让AngularJS输出转义HTML
- 在某些浏览器中,jquery.html()正在取消转义html字符
- 在 JavaScript 中准确取消转义 HTML 实体
- 为什么使用替换来取消转义 html 标签也会去除所有其他 html 标签
- backbone.js正在转义html
- DojoToolkit:如何转义HTML字符串
- 转义 $(“html”).ajaxError() 在其中一个 $.ajax() 调用中
- Meteor React中的转义HTML标签
- 转义HTML标记.字符集编码可能出现的任何问题
- Select2不会转义HTML或javascript
- 我不想转义HTML标记,也不想在Angular应用程序中使用对象文字
- 我不想在Angular应用程序中转义HTML标记
- 转义HTML和Javascript之间的特殊字符
- 如何在laravel 4.2中使用handlebar js转义html
- 在Javascript中转义html属性中的双引号
- 转义HTML标记属性中的双引号
- 在$scope变量中转义HTML的快速方法