ember-cli-accounting icon indicating copy to clipboard operation
ember-cli-accounting copied to clipboard

Uncaught TypeError: Cannot read property 'helper' of undefined

Open NullVoxPopuli opened this issue 9 years ago • 1 comments

I get the above error when I try to use format-money model.unpaid symbol='$' in a template

the relevant code from the browser:

define('accounting/helpers/format-money', ['exports', 'accounting/format-money', 'ember'], function (exports, formatMoney, Ember) {

  'use strict';

  exports['default'] = Ember['default'].Helper.helper(function (params, options) {
    var value = params[0];
    return formatMoney['default'](value, options);
  });

});

I'm new to ember, so I don't know exactly what would cause that.

NullVoxPopuli avatar Aug 27 '15 01:08 NullVoxPopuli

@NullVoxPopuli We fix it by downgrading to 0.0.4 version and creating our own initialiser

import formatNumberHelper from 'accounting/helpers/format-number';
import formatMoneyHelper from 'accounting/helpers/format-money';
import Ember from 'ember';

var helper = (Ember.Handlebars || Ember.HTMLBars).helper;

export var initialize = function(/* container, app */) {
  helper('format-number', formatNumberHelper);
  helper('format-money', formatMoneyHelper);
};

export default {
  name: 'ember-cli-accounting',

  initialize: initialize
};

paperkotter avatar Oct 27 '15 14:10 paperkotter