Is there an elegant way of using methods defined in an Ember.Mixin object within a custom handlebars helper?
For example, in my case I have a mixin, App.Format
which contains a bunch of different methods for formatting numbers, dates, ect and I would like to make some of these methods accessible directly from templates via custom helpers (e.g. {{formatNumber 450324}}
). The reason I don't just put the method implementation directly in the helper instead of the mixin is that I also need these methods to be available in controllers, views, ect. And in the interest of keeping my code DRY, I definitely do not want to have duplicate code in the mixin and the helpers.
Is there any canonical, "emberish" way to accomplish this, or am I just thinking about it in the completely wrong way altogether?
Edit: Here is a jsbin to better illustrate the problem:
http://emberjs.jsbin.com/wunug/1/edit?html,js,output (look at lines 33-37)