X
X
Xbbv12016-08-28 10:11:49
JavaScript
Xbbv1, 2016-08-28 10:11:49

How to set up helpers in webpack handlebars?

Hello. I need to make a condition inside the loop. The example below doesn't work.
{{#each somevar }}
{{#if innNumber === this.inn}}
YES!
{{/if}}
{{/each}}
The innNumber variable is passed when the function is called. this.inn is determined during iteration
As far as I understand, helpers should help me.
Handlebars. registerHelper('if_eq', function(a, b, opts) {
if (a == b) {
return opts. fn(this);
} else {
return opts. inverse(this);
}
});
I connected Handlebars, but here is where to get the Handlebars variable in webpack to set the helper = I don’t understand

Answer the question

In order to leave comments, you need to log in

1 answer(s)
_
_ _, 2016-08-28
@Xbbv1

All webpack plugins have settings. Which specific handlebars plugin are you referring to? There are several.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question