Comments (5)
I could be wrong but isn't that what {{iterate}}
is for?
from handlebars-helpers.
@LaurentGoderre it might… haven't spotted this one. Actually it's missing from the live collection
documentation :-)
I'll give a go and tell you if it's doing the job.
from handlebars-helpers.
I'll get the iterate helper added to the docs, thanks for the heads up! there are other helpers that need to added as well, please let me know if you notice one that isn't documented.
from handlebars-helpers.
@oncletom the syntax described in your original post is not working for me in Assemble 0.4.41 with Handlebars-Helpers 0.5.8. Doesn't seem like the item
(in this case an Object) is applied to this
context within the template. The following only outputs the value of index
, and only outputs the data value when I change {{title}}
to {{item.title}}
(as expected by https://github.com/assemble/handlebars-helpers/blob/bf98ee5d25b914eff3d841f777c2c0ad35075b3b/lib/helpers/helpers-collections.js#L526) in the template.
Doesn't work:
var data: [
{ 'title': 'First title', 'name': 'First name' },
{ 'title': 'Second title', 'name': 'Second name' }
]
{{#eachIndex data}}
<h2>{{index}}: {{title}}</h2>
<p>{{name}}</p>
{{/eachIndex}}
Works:
var data: [
{ 'title': 'First title', 'name': 'First name' },
{ 'title': 'Second title', 'name': 'Second name' }
]
{{#eachIndex data}}
<h2>{{index}}: {{item.title}}</h2>
<p>{{item.name}}</p>
{{/eachIndex}}
from handlebars-helpers.
closing based on age. the repo has been refactored, PRs are very welcome for any changes/new helpers
from handlebars-helpers.
Related Issues (20)
- Comparation(#compare var1 "==" var2) with two variables doesn't work HOT 1
- Upgrade for new versions of the related plugins HOT 1
- does not export a 'register' function, cannot import HOT 1
- Create SECURITY.md
- Not splitting string by line breaks '\n' HOT 1
- todo: merge updates from https://github.com/Budibase/handlebars-helpers HOT 3
- Markdown Helper is broken...
- Vulnerability found (due to highlight.js) HOT 3
- isLast in nested forEach
- Titleize handlebar doesn't titleize input string correctly.
- Request: encode to hex HOT 1
- If loading all helpers the String helper reverse overrides the Array helper reverse. HOT 2
- An examples of working out averages on columns
- Handle empty fields
- String helper `split` doesn't split by empty string.
- This package does not install
- Fumanchu - A supported Handlebar + Handlebars-Helpers together! HOT 4
- query online
- Dead? Process to transfer ownership?
- Dependency "ent" uses deprecated Node punycode module
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from handlebars-helpers.