错误:[$ injector:nomod]模块' ui.bootstrap'不可用!而因果报应在网络风暴中 [英] Error: [$injector:nomod] Module 'ui.bootstrap' is not available! while Karma run in webstorm
问题描述
我在运行业力测试运行时在webstorm中遇到以下错误
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.
但该应用程序可以正常运行
but the application works fine
仅在测试时会显示此错误
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
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
.
or you can specifically inject ui.unique
instead of injecting ui.utils
, if only unique module is used.
这篇关于错误:[$ injector:nomod]模块' ui.bootstrap'不可用!而因果报应在网络风暴中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!