Backbone 模板 underscore template默认的转义符<%= %> 与jsp的冲

先定义转义符,因为默认的转义符<%= %> 与jsp的冲突(如果js模板写在jsp页面中)      

    _.templateSettings = {

       interpolate : /\{\{(.+?)\}\}/g

    };

下面就可以这样写

<script type="text/template" id="detailedBar-template">

        <div class='title'>

            <span class='label'>本次消费</span>

            <span class='numOfDinner'>{{numOfDiner}}人用餐</span>

            <span class='amount'><span class='symbol'>{{currencySymbol}}</span>{{amount}}</span>

        </div>

    </script>

你可能感兴趣的:(Backbone 模板 underscore template默认的转义符<%= %> 与jsp的冲)