mardi 22 septembre 2015

global services in Ember

In my Ember 2 web app I have a couple of services (notify for UX feedback messaging and intl for translations) that are used everywhere. I wonder whether there is any drawbacks in injecting them in any controller (and even every route) through an initializer this way:

/app/initializers/notify-intl.js

export default {
  name: 'notify-intl',
  initialize: function (container, application) {
    application.inject('controller', 'intl', 'service:intl');
    application.inject('controller', 'notify', 'service:notify');
  }
};




Aucun commentaire:

Enregistrer un commentaire