ember-preferences icon indicating copy to clipboard operation
ember-preferences copied to clipboard

ember-1.12.0 doesn't inject the service correctly

Open san650 opened this issue 9 years ago • 1 comments

Right now you have to create a initializer with the following content to inject the service in ember-1.12.0 applications

export function initialize(container, application) {
  ['route', 'controller', 'component'].forEach((type) => {
    application.inject(type, 'preferences', 'service:preferences');
  });
}

export default {
  name: 'register-ember-preferences',
  initialize: initialize
};

san650 avatar Jun 12 '16 19:06 san650

Maybe we can have a initializer specific for ember-1.12.0 and include it in that case.

This is an example from the ember-cli.com documentation https://ember-cli.com/api/classes/Addon.html#method_treeForAddon

treeForAddon: function() {
  var tree = this._super.treeForAddon.apply(this, arguments);
  var checker = new VersionChecker(this);
  var isOldEmber = checker.for('ember', 'bower').lt('1.13.0');

  if (isOldEmber) {
    tree = new Funnel(tree, { exclude: [ /instance-initializers/ ] });
  }

  return tree;
}

san650 avatar Jun 13 '16 00:06 san650