错误:[$injector:nomod] 模块“ui.bootstrap"不可用!而 Karma 在 webstorm 中运行 [英] Error: [$injector:nomod] Module 'ui.bootstrap' is not available! while Karma run in webstorm

查看:28
本文介绍了错误:[$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.

这篇关于错误:[$injector:nomod] 模块“ui.bootstrap"不可用!而 Karma 在 webstorm 中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆