0

I updated from Ember 2.0.0 to 2.2.0 and no I get this "this.lookup is not a function" error when trying to get my custom authenicator.

In my controller I'm doing this:

  var authenticator = self.lookup('authenticator:custom');
  authenticator.signup(data)
  .then(function(data2) {

I simple can't find the new proper way to lookup the service.

Thx for help

EDIT: With @Kitler Input I was able to fix it via a initalizer

export default {
  name:'authenticator',
  after: 'ember-simple-auth',
  initialize: function(app) {
    app.inject('controller', 'authenticator', 'authenticator:custom');
  }
};
PowPi
  • 164
  • 1
  • 1
  • 10
  • 2
    Nowadays you [Ember.inject](http://emberjs.com/api/classes/Ember.inject.html#method_service) services. – Patsy Issa Dec 15 '15 at 13:11
  • @Kitler doing something like this: `authenticator: Ember.inject.service('authenticator:custom'),` ends up in this error: `signup Attempting to inject an unknown injection: service:authenticator:custom` – PowPi Dec 15 '15 at 13:56
  • What is the filename of your service? `authenticator: Ember.inject.service('serviceFileName')` – Patsy Issa Dec 15 '15 at 14:04
  • @Kitler the filename is "custom.js" situated in the folder "authenticators". Doing this: `authenticator: Ember.inject.service('custom')` ends up in this: `signup Attempting to inject an unknown injection: service:custom`. So the problem is that this automatic adds a "service" in the service filename – PowPi Dec 15 '15 at 14:11
  • 1
    Judging from the way [torii](https://github.com/Vestorly/torii/blob/d0f4d2e740b65310c29aa83dba9a9a8bbd540fc6/lib/torii/initializers/initialize-torii.js#L11) does it you might need an initializer to inject it. – Patsy Issa Dec 15 '15 at 14:14

0 Answers0