vendredi 7 août 2015

How to access ember helper from controller?

I have a ember helper for string internalization. When accessing helper file from ember controller I got variable undefined error.

t-18n.js

import Ember from 'ember';

var i18nData = {
"dashboard": "Dashboard",

};

export function tI18n(params/*, hash*/) {
var value = i18nData[params];
if(value) {
return value;
}
return params;
}

export default Ember.Handlebars.makeBoundHelper(tI18n);

Ember Controller

    import i18n from 'osmizer-client/helpers/t-i18n'
    export default Ember.Controller.extend({
actions: {
get: function() {
i18n.tI18n('dashboard')
}
}
});

I got this error "i18n.default.tI18n is not a function TypeError: i18n.default.tI18n is not a function". Please help me to solve this issue.




Aucun commentaire:

Enregistrer un commentaire