【问题标题】:Ember CLI Simple Auth - Cannot read property 'on' of undefinedEmber CLI 简单身份验证 - 无法读取未定义的“on”属性
【发布时间】:2015-03-31 17:21:48
【问题描述】:

我有两个通过 Ember cli 简单身份验证使用 Simple-Auth 的 Ember 1.11 项目。两者中较简单的一个(基本的 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 是“会话”,它显然找不到它。我无法在这个项目之外重新创建它,因此感谢您提供任何帮助。

山姆

【问题讨论】:

  • 您更新了 Simple Auth 吗?
  • 我已经尝试过 0.7.3 和 master 分支。错误仍然存​​在于两者中。
  • 你之前用的是什么版本?
  • 我刚刚开始合并 simple-auth,所以这是我的第一个版本。
  • 你能用你的整个文件创建一个要点吗? gist.github.com

标签: ember.js ember-simple-auth


【解决方案1】:

问题源于这样一个事实,即其中一个依赖项 (ember-modals) 在初始化过程中错误地实例化了 route:application 单例,从而阻止了进一步的注入。 ember-simple-auth 通常将其session 服务注入route:application,但尝试无声无息地失败了。这种行为has been fixedember-modals0.3.0,所以升级应该可以解决问题。

【讨论】:

  • 你帮了大忙!非常感谢您的帮助
猜你喜欢
  • 2021-02-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-08-05
  • 2021-12-05
  • 2021-07-06
相关资源
最近更新 更多