Error: [$injector:nomod] Module 'ui.bootstrap' is not available! while Karma run in webstorm

北慕城南 提交于 2019-12-22 04:43:12

问题


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.

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

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'
        ], 

in my Module declartion

var myApp = angular.module('myApp', ['ui.bootstrap']);

Could you please help ??


回答1:


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']);

or you can specifically inject ui.unique instead of injecting ui.utils, if only unique module is used.



来源:https://stackoverflow.com/questions/22696573/error-injectornomod-module-ui-bootstrap-is-not-available-while-karma-run

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!