I have a simple conditional statement in handlebars, I check that if condition one and condition two is true then print true
however the second condition is nested.
My first condition is checking title is test
My second condition is checking that the label is cream
The first works the second dose not.
can anyone see why the second will not work, why i can not get True to print ?
Json
"one": [
{
"title": "test",
"slider": {
"slides": [
"img/placeholders/WAY-MATERIA-Snaidero.jpg",
"img/placeholders/image_kitchen.jpg",
"img/placeholders/WAY-MATERIA-Snaidero.jpg",
"img/placeholders/image_kitchen.jpg",
"img/placeholders/WAY-MATERIA-Snaidero.jpg",
"img/placeholders/image_kitchen.jpg",
"img/placeholders/WAY-MATERIA-Snaidero.jpg",
"img/placeholders/image_kitchen.jpg",
"img/placeholders/WAY-MATERIA-Snaidero.jpg",
"img/placeholders/image_kitchen.jpg",
"img/placeholders/WAY-MATERIA-Snaidero.jpg",
"img/placeholders/image_kitchen.jpg"
],
"thumbnails": [
"img/placeholders/WAY-MATERIA-Snaidero_60x46.jpg",
"img/placeholders/image_kitchen_60x46.jpg",
"img/placeholders/WAY-MATERIA-Snaidero_60x46.jpg",
"img/placeholders/image_kitchen_60x46.jpg",
"img/placeholders/WAY-MATERIA-Snaidero_60x46.jpg",
"img/placeholders/image_kitchen_60x46.jpg",
"img/placeholders/WAY-MATERIA-Snaidero_60x46.jpg",
"img/placeholders/image_kitchen_60x46.jpg",
"img/placeholders/WAY-MATERIA-Snaidero_60x46.jpg",
"img/placeholders/image_kitchen_60x46.jpg",
"img/placeholders/WAY-MATERIA-Snaidero_60x46.jpg",
"img/placeholders/image_kitchen_60x46.jpg"
]
},
],
"colors": [
{
"color": "#F3DCAE",
"label": "Cream",
"href" : "http://google.com"
}
]
},
]
.HBS file
True
My gulp file
handlebars.Handlebars.registerHelper('if_eq', function(a, b, opts) {
if (a === b) {
return opts.fn(this);
} else {
return opts.inverse(this);
}
});
Aucun commentaire:
Enregistrer un commentaire