Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to use @index from 1 got this error #509

Closed
techyrajeev opened this issue Jun 9, 2016 · 4 comments
Closed

Trying to use @index from 1 got this error #509

techyrajeev opened this issue Jun 9, 2016 · 4 comments

Comments

@techyrajeev
Copy link

could not find helper: 'math'

{{math @Index "+" 1}}. {{item}}

Is math helper functions not available? is there any way to use index from 1 instead of zero?

@jknack
Copy link
Owner

jknack commented Jun 9, 2016

did you figure it out, right? There is no math helper, but you are safe to use {{@index_1}}

Also, I invite you to try: http://jooby.org

@techyrajeev
Copy link
Author

techyrajeev commented Jun 10, 2016

I figured it out. I created a helper method to increment the index. But didn't know about {{@index_1}}, will give it a try. Thanks a lot for the tip.

@techyrajeev
Copy link
Author

@jknack It is working well. One thing I noticed helpers have a registerDecorators. What is the use of decorators here ? Docs do not mention it.

@jknack
Copy link
Owner

jknack commented Jun 10, 2016

Good, but yea you don't need a custom helper for +1 just use ``{{@index_1}}`

That's right there isn't good doc about decorators. It is for advanced users work with reference to handlebars.js is here #433 and here #442

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants