handlebars.js - Assemble partial looping through data -
handlebars.js - Assemble partial looping through data -
i'm using assemble generate new site , want modularise much possible. 1 of components looping through list of info , generating list of items.
my component called ratings , looks this:
--- ratings: - review: recommend company. reviewrating: 10 reviewlocation: berkhamsted reviewdate: 11/03/2014 - review: pleasant, prompt, fantastic, recommend them. reviewrating: 10 reviewlocation: cranbrook reviewdate: 11/02/2014 - review: reliable , nice people have around property, great workmanship. reviewrating: 10 reviewlocation: chelmsford reviewdate: 16/10/2013 - review: first-class service , have recommended them other people reviewrating: 10 reviewlocation: dartford reviewdate: 14/06/2013 - review: professional , great installation. have them back. couldn't more pleased them. outstanding, top class. reviewrating: 10 reviewlocation: halstead reviewdate: 29/04/2013 --- {{#foreach ratings}} {{reviewrating}} - {{review}} -- {{reviewlocation}} --- {{reviewdate}} {{/foreach}}
and in page have following:
{{> ratings }}
when compile assemble files next error
warning: cannot read property 'length' of undefined utilize --force continue.
but when include info , loop in page works fine doesn't allow re-use.
assemble v0.4.x namespaces partial front end matter name of partial, should able access like...
{{#foreach ratings.ratings}} {{reviewrating}} - {{review}} -- {{reviewlocation}} --- {{reviewdate}} {{/foreach}}
the first ratings
name of partial , sec `ratings list in front end matter.
try , see if works.
handlebars.js assemble
Comments
Post a Comment