【问题标题】:AngularJS Meteor $controller won't take binding argument -- angular version issueAngularJS Meteor $controller 不会接受绑定参数——角度版本问题
【发布时间】:2017-08-21 12:00:23
【问题描述】:

我正在尝试编写一个带有 before 钩子的测试,如下所示:

beforeEach(()=>{
  inject(function ($rootScope) {
    scope = $rootScope.$new(true);
    controller = $controller('userDetailsCtrl', {$scope: scope}, {locals: {userId: testUserId}});
});}

但我收到一条消息,compileProvider.preAssignBindingsEnabled is not a function 我相信这是因为 angular-meteor 使用的是 AngularJS 1.5.3。是否有解决此问题的方法或强制它使用更新版本的 angular 的方法?

【问题讨论】:

  • 你尝试注入 $controller 了吗?
  • 是的,对不起,我漏掉了,我有另一个之前的钩子,可以beforeEach(inject(function (_$controller_, _$cookies_) { $controller = _$controller_; $cookies = _$cookies_; }));
  • 但是你仍然得到同样的错误信息?
  • 没错
  • 你使用什么版本的角度和角度模拟?

标签: angularjs meteor angular-meteor


【解决方案1】:

看起来在这个post 中你可以得到关于你的问题“如何在 angular-meteor 中更改 angular 版本”的答案。

【讨论】:

  • 我玩了一下,我想我实际上可能有正确版本的 angular,也许是 angular mocks 的版本,但我不知道为什么会出错
【解决方案2】:

所以我发现如果我将 angular-mocks 降级到 1.5.5,我可以让它工作。有人知道如何让它在以后的版本上工作吗?

【讨论】:

    猜你喜欢
    • 2016-12-04
    • 2018-02-28
    • 1970-01-01
    • 1970-01-01
    • 2018-01-26
    • 2019-01-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多