I am refering to this particular deprecation that was introduced in Ember 1.12
lookup
was called on a Registry. Theinitializer
API no longer receives a container, and you should use aninstanceInitializer
to look up objects from the container
I looked at the guide, but I am unsure on how to fix this.
Here's a snippet of the code I have at the moment
initialize = (container, app) ->
auth = container.lookup('auth-manager:main')
local_config = ($.ajax
type: 'GET'
url: '/config.json'
async:false
).responseJSON
external_config = ($.ajax
type: 'GET'
url: local_config.crm.provisioning.url + '/v1/configurations'
dataType: 'json'
headers:
'Authorization': auth.get 'token'
'Accept': 'application/json'
'Content-Type': 'application/json'
async: false
error: (e)->
if e.status == 401
window.location.href = window.location.origin + '/auth.html?src_url=' + window.location.href
).responseJSON
ConfigInitializer =
name: 'config'
after: 'auth-manager'
initialize: initialize
The problem is that I require the auth-manager
initializer in order to initialize my config
initializer. Most of my other initializers require both the config
and auth-manager
initializers to get an access_token and connection endpoints.
In a ember-cli project should there be one file for the instance initializer and one for the registration of the initializer ?
The example given in the ember doc really confuses me.
I haven't hit this one yet, but hopefully this will lead somewhere useful. https://github.com/emberjs/ember.js/issues/10177
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With