Closed isahuja closed 7 years ago
I am getting data from service in which array of objects are coming like below:-
[{
title : 'Tilte 1',
s.no : 1
},
{
title : 'Tilte 2',
s.no : 2
}
]
I have used handlebars templating to parse this data like below:-
{{#each this}}
<div>
<span>{{this.s.no}}</span>
<h2>{{this.title}}</h2>
</div>
{{/each}}
In the above I am not able to access the property('s.no'). In vanila javascript we can access it like this['s.no'] but in handlebars it's not working.
Thanks in advance
{{this.[s.no]}}
should work. Have a look a the http://handlebarsjs.com/expressions.html for the details.
https://jsfiddle.net/vva7musq/14/ for an example
@nknapp Thanks, it's working.
Before filing issues, please check the following points first:
This will probably help you to get a solution faster. For bugs, it would be great to have a PR with a failing test-case.