I'm trying to pass a parameter from my HTMLBars template to a Helper.
As per the documentation, I've created a helper and explicitly registered the helper:
export default Ember.HTMLBars.makeBoundHelper('is-foo', function(value, options) {
console.log("value: "+value);
});
But I get an error "Error: Assertion Failed: makeBoundHelper generated helpers do not support use with blocks"
So I've tried using Ember.HTMLBars.helper and Ember.HTMLBars.registerHelper as suggested here but I get errors "TypeError: Ember.default.HTMLBars.helper is not a function"
If I don't reigster the helper explicitly:
export default function(value, options) {
console.log("value: "+value);
};
Then I can pass a parameter, but it doesn't get resolved and logs out the literal text of what I passed.
So I tried the solution outlined here but it doesn't seem to work with CLI
The result I want is for a component to be dynamically selected based on the value of the parameter I send to the helper. My HTMLBars code looks like:
{{#each foo in model}}
{{is-foo parameter}}
{{a-component}}
{{else}}
{{another-component}}
{{/is-foo}}
{{/each}}
I'm not sure what to do next. Any help is appreciated.
ember g helper foo
. It will create a foo helper for you. Then you can look at its code to see how you can make your own manually. – Grapho