javascript - Marionette.js 模板打印不完整

标签 javascript templates backbone.js marionette

<script id="my-template" type ="text/template"> <div>test</div><br/> <%=console.log("ENFIN")%> </script>

当我调用我的模板时:

var myView = new ProfileView({model: myProfile});
myView.render();

仅出现控制台日志,不出现测试

有什么想法吗?

非常感谢

最佳答案

用 DIV 标签将脚本模板中的所有内容包裹起来...这将解决您的问题

<script id = "my-template" type = "text/template"> 
    <div>
         <div>test</div>
         <%=console.log( "ENFIN")%>
    </div>
</script>

关于javascript - Marionette.js 模板打印不完整,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17297181/

相关文章:

JavaScript onclick 处理程序不聚焦或滚动

javascript - 向服务器传递参数(Stripe Connect 中的 oAuth 回调)

ruby-on-rails - Rails 应用程序模板

Backbone.js 通过 RegEx 捕获事件?

javascript - ReactJS 嵌套列表 (flux)

javascript - 如何更新模型是集合的一部分

javascript - 如何单击 Protractor 中的 ui-sref 链接?

javascript - 计算 Canvas 中线与圆的交点坐标和线的度数

xslt - 调用同一个 xsl :template for different node names of the same complex type

c++ - 为什么在 C++ 中调用此虚函数会导致基类出现 'missing symbol' 错误?