Your code should work, but you’re using your helper
{{sample}}
in the template without passing it any arguments. Even if you’re testing to see if things work, pass it a test string like
{{sample "some string"}}
You need to do that because you’re using the helper in a raw hbr template. For testing purposes, the helper should work even if you don’t pass it anything in regular hbs templates.
If you’re creating a block-helper, then it needs to have # and you need to close it like so.
{{#sample}}
{{/sample}}
Adding ~ to your helper optionally trims whitespace between any HTML tags it returns. So
Thank you for your reply. You are helping me a lot.
Yes, I have already gone through the documentation, existing themes and few examples, and created this sample project. But I am not sure about how to call the helper function in handlebar file. I tried it in multiple ways, and it was not working. That’s why, I posted here.