I am new to handlebars and trying to get the first letter from a looped string i.e
{{#each message}}
<div class='name'>{{this.user}}</div>
<div class='img'><h1 class="abbr">{{this.user.charAt(0)}}</h1></div>
<div class='text'>
<div>
{{this.text}}
</div>
</div>
{{/each}}
I have tried {{this.text[0]}} and {{this.text.charAt(0)}}
You can use Preparation-Script to achieve this : HandleBars Documents
must register helper and use it:
Handlebars.registerHelper('returnOnlyZeroindex', function () {
return this.user[0]
})
and use like this:
<p>{{returnOnlyZeroindex}}</p>