You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Question: How to create a custom helper with access to @index #151
Is this something that's on the roadmap? I was about to switch from our current templating engine to this, but I'm not sure I can. I need to be able to create a two-column or a three-column table (for HTML email) from a list of objects. Without being able to pass @index to some helper to check if the index is a multiple of 3 or whatever, and without adding some sort of index field to whatever data is being passed in, is there any way to do that?
If it's something the handlebarsjs library supports, then absolutely it is in the roadmap. The #1 goal of this library is to stay as close as possible to feature parity with handlebarsjs.
PRs are always welcome... scratching your own itch is the fastest way to move the project forward. The ability for a helper to add context variables seems like something that will require a bit more thoughtfulness... I look forward to ideas on how to implement it.
Hello everybody. Please provide some info on the current thread. I saw that some code for this issue was merged into the main branch but I am unable to pass the {{@index}} into a custom Block Helper. It is always sending NULL.
Hello @spc-89 . The functionality is going to become available in 2.0 version of the library. It's going to be published once my fork would be merged to the trunk. Follow PRs to be updated.
Activity
rexm commentedon Sep 7, 2016
That's not supported right now. Does the JS library support it, and if so how does that work?
Thanood commentedon Sep 7, 2016
It's shown as a helper example here: http://handlebarsjs.com/block_helpers.html (section "Hash Arguments"), last example.
greg-ellis commentedon Dec 2, 2016
Is this something that's on the roadmap? I was about to switch from our current templating engine to this, but I'm not sure I can. I need to be able to create a two-column or a three-column table (for HTML email) from a list of objects. Without being able to pass @index to some helper to check if the index is a multiple of 3 or whatever, and without adding some sort of index field to whatever data is being passed in, is there any way to do that?
rexm commentedon Dec 2, 2016
If it's something the handlebarsjs library supports, then absolutely it is in the roadmap. The #1 goal of this library is to stay as close as possible to feature parity with handlebarsjs.
PRs are always welcome... scratching your own itch is the fastest way to move the project forward. The ability for a helper to add context variables seems like something that will require a bit more thoughtfulness... I look forward to ideas on how to implement it.
Extreme refactoring/enhancements
spc-89 commentedon Aug 20, 2020
Hello everybody. Please provide some info on the current thread. I saw that some code for this issue was merged into the main branch but I am unable to pass the {{@index}} into a custom Block Helper. It is always sending NULL.
oformaniuk commentedon Sep 7, 2020
Hello @spc-89 . The functionality is going to become available in 2.0 version of the library. It's going to be published once my fork would be merged to the trunk. Follow PRs to be updated.