带Underscore的Uncaught Syntaxerror.Unexpected标识符

时间:2014-03-30 06:25:13

标签: jquery twitter-bootstrap underscore.js underscore.js-templating

您好,我收到了上述错误,并在努力寻找问题所在。

这是代码。

<%if(Validations!==null)%>
<%if(Validations.length)%>
<% _.each(Validations, function(validation){%>
<% _.each(ApplicationTemplateFields, function(applicationTemplateField){%>
<% if(applicationTemplateField.UniqueKey == validation.UniqueKey) {%>
<div class="form-group has-error">
    <label for="<%= applicationTemplateField.FieldName %>"><%= applicationTemplateField.FieldName %></label>
    <label class="control-label" for="inputError1"><%= validation.ValidationMessage %></label>
    <input type="text" class="form-control inputs" id="inputError1" data-fieldkey="<%= applicationTemplateField.UniqueKey %>">
</div>
<%} else {%>
<div class="form-group">
    <label for="<%= applicationTemplateField.FieldName %>"><%= applicationTemplateField.FieldName %></label>
    <input type="text" class="form-control inputs" id="input<%= applicationTemplateField.Id %>" placeholder="Enter <%= applicationTemplateField.FieldName %>" data-fieldkey="<%= applicationTemplateField.UniqueKey %>">
</div>
<% } %>
<% }) %>
<% }) %>
<% } %>
<% } %>

可能指出问题出在哪里。?

1 个答案:

答案 0 :(得分:0)

搞定了......愚蠢的语法错误

<%if(Validations!==null)%>
<%if(Validations.length)%>

应该是

<%if(Validations!==null){%>
<%if(Validations.length){%>