Can anybody tell me how to include commented code in emberjs handlebars templates?
<script id="restaurantDetail" data-template-name='restaurantDetail' type="text/x-handlebars">
//Commented code goes here
</script>
Can anybody tell me how to include commented code in emberjs handlebars templates?
<script id="restaurantDetail" data-template-name='restaurantDetail' type="text/x-handlebars">
//Commented code goes here
</script>
From the looks of the github page, you want {{! comment text here}}
:
Comments
You can add comments to your templates with the following syntax.
{{! This is a comment }}
You can also use real html comments if you want them to end up in the output.
<div> {{! This comment will not end up in the output }} <!-- This comment will show up in the output --> </div>
I recommend using {{!-- comment here --}}
because this comment syntax can contain new lines and also }}
inside the comment, for example:
Bad comments:
{{! badly commented {{if somecondition "red" "blue" }} }}
{{! badly multiline comments
another line }}
Comment that works:
{{!-- this is commented correctly {{if somecondition "red" "blue" }} --}}
{{!-- correct multiline comments
another line --}}
(I know this is an old question, but this answer appears first on Google when searching for ember template comments, so I wanted to help future readers)
© 2022 - 2024 — McMap. All rights reserved.
<!-- Item {{unbound itemId}} -->
– Calicle