當我使用jsrender模板引擎時,我想在代碼中添加一些註釋,但是我找不到註釋的標籤。如何在jsrender中設置註釋
我知道我可以使用html註釋,但我不希望這些註釋完全在html上呈現,所以<!-- -->
已超出選項。
所以,我想擁有的是:
<script id="row-template" type="text/x-jsrender">
{{// some comment that will not be rendered}}
{{if #data[0]}}
<tr>
{{for #data tmpl="#some-template"/}}
</tr>
{{/if}}
</script>
我很好奇,爲什麼在模板評論甚至必要的。如果您的模板非常複雜以至於無法解釋它的解釋,那麼也許您應該重新評估模板的構建方式。 – 2013-03-20 13:55:43
那麼,我的模板並不複雜,但是您是否知道爲什麼我僅在數據[0]不爲空的情況下在此示例中呈現此模板? – dugokontov 2013-03-20 15:18:41