I feel like I may be doing to much for a simple problem.
If index = 0
, how do I increment index
in a template.
Ideally, I would like to do something like this.
{{index+1}}
From what I understand the solution is to write a helper function like the following.
import Ember from 'ember';
export function plusOne(params) {
return parseInt(params) + 1;
}
export default Ember.HTMLBars.makeBoundHelper(plusOne);
And then in the template you would do the following.
{{plus-one index}}
So hopefully, I am wrong and there is a much easier way to do this. And possibly a easier way to do 'simple' processing in the template. Not sure if there may be an objection because there may be 'to much' logic in the template.
Any guidance on this would be greatly appreciated.
Thanks!