2013-09-01 44 views
0

我想使用模運算符使用jQuery的模板,但也許出現語法錯誤語法錯誤,jQuery的模板

Uncaught SyntaxError: Unexpected token { 

{{if Items.length > 0}} 
    <div> 
     <table class='table table-bordered' style='width:450px;'> 
      <thead style='text-align:center;'> 
      <td> 
       <strong>Related Topics</strong> 
      </td> 
      </thead> 
      {{each Items}} 
      {{if ${$index} % 6===0}} 
       <td> 
         <input type='hidden' name='subUniqueKey${DomainObjectUniqueKey}' value='${DomainObjectUniqueKey}' /> 
         <input type='checkbox' name='chkTopics${DomainObjectUniqueKey}'/><label id='labRelTopicsDisplay${DomainObjectUniqueKey}'>${subject}</label> 
       </td> 
      {{/if}} 
     {{/each}} 
     </table> 
    </div> 
{{/if}} 

意見,以其中的謬誤在於

感謝

回答

1

我想這是導致錯誤的部分

{{if ${$index} % 6===0}} 

嘗試將其更改爲

{{if $index % 6===0}} 
+0

是的,那是正確的,謝謝 – Arianule