我正在学习 ember.js,有时想停用一些代码块。我知道{{! }}
适用于 <script type="text/x-handlebars">
内的单行注释,但我无法使其适用于多行注释。也许是因为我里面有条件语句。
<script type="text/x-handlebars" id="stuff">
{{!
{{#if length}}
foobar
{{/if}}
}}
</script>
但是后来我得到了这个错误:
Uncaught Error: Parse error on line xx:
...ngth}} foobar {{/if}}}} {{ o
---------------------^
Expecting 'EOF', got 'OPEN_ENDBLOCK'
我还尝试使用 <!-- ... -->
,虽然该部分未显示,但我也收到此错误:
未捕获错误:无法对不在 DOM 中的 Metamorph 执行操作
如果我只是删除该代码块,则不会显示此错误。
最佳答案
添加
{{!--
This is a
multiline
comment
--}}
用于多行注释
关于ember.js - 如何在 ember.js 脚本句柄中使用条件语句进行多行注释?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16822163/