5

I am using Ember CLI and have read the 1.12.0 release blog entry here:

http://emberjs.com/blog/2015/05/13/ember-1-12-released.html#toc_instance-initializers

and this article:

http://emberjs.com/deprecations/v1.x/#toc_deprecate-access-to-instances-in-initializers

but although I believe I have followed the instructions correctly I am still getting the following deprecation warning:

DEPRECATION: lookupFactory was called on a Registry. The initializer API no longer receives a container, and you should use an instanceInitializer to look up objects from the container. See http://emberjs.com/guides/deprecations#toc_deprecate-access-to-instances-in-initializers for more details.

I have an initializer that injects a service called "ui" and therefore I believe it to be an application initializer rather than an instance initializer (though I have tried both). My initializer code sits under /app/initializers/ui.js and is as follows:

export function initialize(registry, application) {
    application.inject('route', 'ui', 'service:ui');
    application.inject('controller', 'ui', 'service:ui');
}

export default {
    name: 'ui',
    initialize: initialize
};

Can anyone advise me what I am doing wrong please?

Thanks!

UPDATE: It looks like others are having similar issues:

https://github.com/emberjs/ember.js/issues/11172

http://discuss.emberjs.com/t/dependancy-injection-in-initializers-confusing-registry-container/7972/2

danr1979
  • 461
  • 1
  • 3
  • 10
  • Put them under the folder 'instance-initializers'. http://stackoverflow.com/questions/30241691/using-instance-initializers-with-ember-1-12-0-and-the-ember-cli – blessanm86 May 15 '15 at 09:55
  • 1
    Thanks for your reply but my initializer is not an instance initializer as it is being used purely to inject a service. In the links mentioned above it says these are application initializers which belong in the "initializers" folder. I did try the folder you suggested but it made no difference. – danr1979 May 15 '15 at 19:59
  • It looks like there's an open issue for this on ember data: https://github.com/emberjs/data/issues/3051 – mayatron May 26 '15 at 18:10

1 Answers1

0

Fixed by recent updates so no longer an issue. Thanks for all the comments.

danr1979
  • 461
  • 1
  • 3
  • 10
  • danr1979 could you give more details how did you solve it? Thanks – Moh Sep 03 '15 at 15:08
  • Hi. I just updated to the latest version at the time (1.13 I think) & that fixed it. The deprecation message was being shown in error in my case. – danr1979 Sep 04 '15 at 04:26