# How to create template helper in Discourse

**URL:** https://meta.discourse.org/t/how-to-create-template-helper-in-discourse/143408
**Category:** Development
**Created:** [March 5, 2020, 2:49pm UTC](https://meta.discourse.org/t/how-to-create-template-helper-in-discourse/143408 "2020-03-05T14:49:14Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![saurabhmasc](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@saurabhmasc](https://meta.discourse.org/u/saurabhmasc)
#### Post date: [March 5, 2020, 2:49pm UTC](https://meta.discourse.org/t/how-to-create-template-helper-in-discourse/143408/1 "2020-03-05T14:49:14Z")

</div>

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**

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [March 5, 2020, 2:57pm UTC](https://meta.discourse.org/t/how-to-create-template-helper-in-discourse/143408/2 "2020-03-05T14:57:08Z")

</div>

It’s just EmberJS, use a Computed Property.

---

<div class="post-metadata">

### Author: ![saurabhmasc](https://avatars.discourse-cdn.com/v4/letter/s/4bbf92/32.png) [@saurabhmasc](https://meta.discourse.org/u/saurabhmasc)
#### Post date: [March 6, 2020, 4:57am UTC](https://meta.discourse.org/t/how-to-create-template-helper-in-discourse/143408/3 "2020-03-06T04:57:37Z")

</div>

I want to achieve somewhat like below:  
have two each loop

1. productCategories : [“category1”, “category2”, …]
2. 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?

> ```
> <div class="tag-list-section">
> {{#each this.productCategories as |category|}}
> <div id={{category}} class="select-tag-category">
> {{#each this.productTags as |tag|}}
> {{#if (eq category tag.productCategory)}}
> {{input type="checkbox" name=tag.tagName checked=tag.isChecked }} {{tag.tagName}}
> {{/if}}
> {{/each}}
> </div>
> {{/each}}
> </div>
> 
> ```
