我指的是Ember 1.12中引入的这种特定的弃用



我看了看指南,但是不确定如何解决。

这是我目前的代码片段

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

问题是我需要auth-manager初始化程序才能初始化config初始化程序。我的大多数其他初始化程序都需要configauth-manager初始化程序才能获得access_token和连接端点。

在ember-cli项目中,实例初始化程序应该有一个文件,而初始化程序的注册应该有一个文件吗?

ember文档中给出的示例确实让我感到困惑。

最佳答案

我还没有打过这个,但是希望这会带来一些有用的东西。
https://github.com/emberjs/ember.js/issues/10177

关于ember.js - 修复Ember 1.12.0中弃用的初始化程序,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/30508348/

10-11 14:41
查看更多