错误:[$injector:nomod] 模块“ui.bootstrap"不可用!而 Karma 在 webstorm 中运行
我在 webstorm 中运行 karma test run 时遇到以下错误
Hi I'm getting the following error in webstorm while running karma test run
Error: [$injector:nomod] Module 'ui.bootstrap', 'ui.unique' is not available!
You either misspelled the module name or forgot to load it.
If registering a module ensure that you specify the dependencies as the second argument.
我在互联网上查看,他们说检查依赖文件 ui.bootstrap 可能会像那样错过.
i looked in the internet and they said to check dependency file ui.bootstrap might be missed like that.
但应用程序运行良好
并且仅在测试时显示此错误
and while testing only it shows this error
在我的 karma.conf.js 中
in my karma.conf.js
files: [
//angular files
'app/js/vendor/angular/ui.bootstrap.js',
'app/js/vendor/angular/ui.bootstrap-0.10.0.js',
'app/js/vendor/angular/angular.js',
'app/js/vendor/angular/angular-mocks-0.10.6.js',
'app/js/app.js',
'test/**/*Spec.js'
],
在我的模块声明中
var myApp = angular.module('myApp', ['ui.bootstrap']);
你能帮忙吗??
ui.unique
是来自 angular-ui-utils
.如果使用,必须将其包含在 karma conf 中并注入到应用程序中.
ui.unique
is a module from angular-ui-utils
. That has to be included in karma conf and injected to the app as well, if being used.
var myApp = angular.module('myApp', ['ui.bootstrap', 'ui.utils']);
或者你可以专门注入 ui.unique
而不是注入 ui.utils
,如果只使用 unique 模块.
or you can specifically inject ui.unique
instead of injecting ui.utils
, if only unique module is used.