How to add an Ember js helper?


(JT) #1

I’m trying to add an emberjs helper to an existing plugin (discourse-tagging).

According to the ember docs, you should place a helper in app/helpers, and name it helper-name.js.

It can then be used like this: {{ helper-name value }} in templates.

However, no matter where I place the file it I get the error: “Uncaught Error: Assertion Failed: A helper named ‘helper-name’ could not be found”

I’ve tried these locations:
app/helpers/
assets/javacripts/discourse/helpers

Where should emberjs helpers be placed in plugins?

Thanks! :slightly_smiling:


Trouble adding Ember helper
(Robin Ward) #2

In your plugin, you should add it in assets/javascripts/discourse/helpers and make sure it has a dash in the filename like test-helper.

I just tried this locally and the helper was registered. I see you tried that path and it did not. Perhaps you need to rm -rf tmp in development mode?


(Robin Ward) #3