Ember CLI 简单验证 - 无法读取未定义的 属性 'on'

Ember CLI Simple Auth - Cannot read property 'on' of undefined

我有两个 Ember 1.11 项目,它们通过 Ember cli simple auth 使用 Simple-Auth。两者中较简单的一个(基本的 hello world 应用程序)工作得很好......事实上它工作得很好(简单的身份验证非常棒)。但是,另一个(最近升级的应用程序)有某种初始化错误。

我的错误是:

Error while processing route: receiving.index Cannot read property 'on' of undefined TypeError: Cannot read property 'on' of undefined

它在 beforeModel 函数中的 ApplicationRouteMixin 中断:

_this.get(Configuration.sessionPropertyName).on(event, function(error) {
    Array.prototype.unshift.call(arguments, event);
    var target = routeEntryComplete ? _this : transition;
    target.send.apply(target, arguments);
});

Configuration.sessionPropertyName是"session",显然是找不到的。我无法在这个项目之外重新创建它,因此感谢您的帮助。

山姆

问题源于 ember-modals 中的一个依赖项(ember-modals) incorrectly instantiated the route:application singleton during the initialization process, preventing further injections. ember-simple-auth normally injects it's session service into route:application, but the attempt was silently failing. This behavior has been fixed0.3.0 以来,因此升级应该可以解决问题。