I want to compare two values in the handlebar template. This cannot be done using {{#if}} helper. So how can I create a new helper in Discourse?
I have tried below code but not working:
Created FIle: /assets/javascripts/discourse/helpers/eq.js.es6
import { registerHelper } from 'discourse-common/lib/helpers'
var makeBoundHelper = Ember.HTMLBars.makeBoundHelper;
registerHelper('eq', makeBoundHelper(function(params) {
return params[0] === params[1];
}));
Throwing Exception: makeBoundHelper is not a function
I want to achieve somewhat like below:
have two each loop
productCategories : [“category1”, “category2”, …]
productTags : [{productCategory:“category1”, tagName:“tag1”, isChecked:true}, …]
And now i want to compare productCategories items with tag.productCategory as shown in code.
Can we achieve this by Computed properties?