I have followed the ember guide to create an handlebar helper like in this jsbin
This is the helper
Ember.Handlebars.registerBoundHelper('format-date', function(format, date) {
return moment(date).format(format);
});
I can successfully reuse in my jsbin but i get an error when i apply the same helper in my application, this is the error Uncaught TypeError: fn.apply is not a function in my helper function , i am not implementing it correctly in my ember-cli
This is the same helper in my application
import Ember from 'ember';
export default Ember.Handlebars.registerBoundHelper('format-date', function(format, date) {
return moment(date).format(format);
});
What's the problem?
I have also used makeBoundHelper
instead of registerBoundHelper
Just to let you know i have generated the ember helper in these steps
1) From command prompt run ember generate helper "format-date"
This was the helper generated
import Ember from 'ember';
export function formatDate(params/*, hash*/) {
return params;
}
I am definitely mistaking the way i am exporting the format-date
helper
How it should be in my ember-cli?
P.s. I am still using Ember 1.12.0 , i have seen a similar issue here
helpers
, current 2.x api is most simplestEmber.Helper.helper(your helper code)
if possible upgrade your ember – Bek