I'm trying to create a custom helper to format a value, the ember-cli docs seem to indicate I either need to export makeBoundHelper from within my helper file, or registerBoundHelper from within app.js whilst importing the previously created helper function.
Is my understanding of this correct? Or can you use registerBoundHelper from within a helper file and have it register correctly.
EDIT
related code and error info below:
https://github.com/ridget/transactions/blob/master/app/helpers/to-currency.js
Just pushed that up, using registerBoundHelper
results in "Uncaught TypeError: undefined is not a function"
http://iamstef.net/ember-cli/ under resolving handlebars helpers seems to indicate that I can only utilise registerBoundHelper from within app.js but not sure if this is the case or im just doing it wrong.
As per docs
makeBoundHelper is
A (mostly) private helper function to `registerBoundHelper`. Takes the
provided Handlebars helper function fn and returns it in wrapped
bound helper form.
@private
@method makeBoundHelper
@for Ember.Handlebars
@param {Function} function
@param {String} dependentKeys*
So basically both does same job. Difference is registerBoundHelper
is available as public. Also parameters are different.
@method registerBoundHelper
@for Ember.Handlebars
@param {String} name
@param {Function} function
@param {String} dependentKeys*
makeBoundHelper doesn't take name of the helper. You may need to register helper on your own by calling
Ember.Handlebars.registerHelper(name, boundFn);
boundFn
is makeBoundHelper
callback
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With