这是我的代码,
HTML:
<script type="text/html" id="test_temp">
<div class="row" id="opportunityList">
<% _.each(ops, function(option){
<div class="span12">
<div class="well basicInformation">
<div class="row">
<div class="span4 opportunityName" >
<h4><%= option.company_name %></h4>
</div>
<div class="span4 pull-right">
<ul class="inline">
<li class="dealGrade">
<span><%= option.dealGrade %></span>
<span class="subheader">Deal Grade</span>
</li>
<li class="estimateddevices">
<span><%= option.devices %></span>
<span class="subheader">Devices</span>
</li>
<li class="accountValue">
<span><%= option.accountValue %></span>
<span class="subheader">Account value</span>
</li>
</ul>
</div>
</div>
</div>
</div>
});
%>
</div>
</script>
脚本:
testView = Backbone.View.extend({
initialize: function(){
this.render();
},
render: function(){
var ops = [
{dealGrade: '50%', devices: 123, accountValue: '20%', company_name: 'Kyocera', rep_name: 'James Kogg', rep_designation: 'Sales Rep', proposalCount: 2},
{dealGrade: '75%', devices: 215, accountValue: '41%', company_name: 'Flipkart', rep_name: 'Christina Kogg', rep_designation: 'MD', proposalCount: 0}
]
var template = _.template($("#test_temp").html(), ops);
this.$el.append(template);
}
});
var test_view = new testView({ el: $("#viewport .container") });
我收到此错误消息:
Uncaught SyntaxError: Unexpected token < in underscore.js
我究竟做错了什么?