0

错误:[$injector:modulerr] 无法实例化模块 ngIdle,原因是:错误:[$injector:nomod] 模块 'ngIdle' 不可用!您要么拼错了模块名称,要么忘记加载它。如果注册模块,请确保将依赖项指定为第二个参数。

我错过了什么?如果我不包含 ngIdle 模块并删除它的实现代码,那么我所有的业力/茉莉花测试都通过了,但包含 ngIdle 的所有 100 多个测试用例都失败并给出上述错误。我已包含ngIdlekarma.conf.js此订单中

files: [
'app/bower_components/angular/angular.js',
'app/bower_components/angular-route/angular-route.js',
'app/bower_components/angular-touch/angular-touch.js',
'app/bower_components/angular-animate/angular-animate.js',
'app/bower_components/angular-bootstrap/ui-bootstrap-tpls.min.js',
'app/bower_components/angular-mocks/angular-mocks.js',
'app/bower_components/angular-resource/angular-resource.js',
'app/bower_components/revolunet-angular-carousel/lib/angular-mobile.js',
'app/bower_components/revolunet-angular-carousel/src/angular-carousel.js',
'app/bower_components/jquery/dist/jquery.js',
'app/bower_components/angular-cookies/angular-cookies.min.js',
'app/bower_components/ng-idle/angular-idle.min.js',
'app/bower_components/ng-grid/ng-grid-2.0.11.min.js',
'app/js//*.js',
'test/spec//*.js'
 ],

以下是我的 bower.json,因此您可以了解我正在使用的版本(如果相关)

{
  "name": "combo",
  "version": "0.5.1",
  "dependencies": {
    "angular": "~1.3",
    "angular-route": "~1.3",
    "angular-touch": "~1.3",
    "angular-animate": "~1.3",
    "angular-resource": "~1.3",
    "angular-cookies": "~1.3",
    "angular-bootstrap": "~0.11.0",
    "revolunet-angular-carousel": "~0.2.2",
    "ng-grid": "~2.0.7",
    "ng-idle": "latest",
    "video.js": "~4",
    "highcharts": "~3.0.7",
    "jquery": "~2",
    "jquery-ui": "~1.10.4",
    "jqueryui-touch-punch": "git://github.com/furf/jquery-ui-touch-punch.git",
    "angular-snap": "~1.4.1",
    "snapjs": "latest"
  },
  "devDependencies": {
    "angular-mocks": "~1.3",
    "angular-scenario": "~1.3"
  },
  "resolutions": {
    "angular": "~1.2.10",
    "angular-touch": "~1.2.10",
    "jquery": "^1.8.0"
  }
}
4

1 回答 1

1

您必须将angular-idle.min.js添加到您的karma.conf.js中。

files: [
  //Configs
  'config.js',

  'lib/angular/angular.min.js',
  'lib/angular-mocks/angular-mocks.js',
  'lib/moment/moment.js',
  'lib/ng-idle/angular-idle.min.js',
  'lib/angular-moment/angular-moment.js',
  // ... another libraries
],
于 2014-08-01T01:43:48.803 回答