我试图在我用gulp构建的coffeescript AngularJS应用程序中使用角度矩。它在应用程序中工作正常,没有任何问题,但是当我尝试运行我的业力+摩卡测试套件时,它失败了,用这个:
Error: [$injector:modulerr] Failed to instantiate module angularMoment due to:
Error: [$injector:nomod] Module 'angularMoment' 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.
我在应用程序中加载了角度矩,显然是:
angular.module("prometheus", [
'ui.router'
'ngAnimate'
'angularMoment'
])
我将其加载到脚本代码中
script(src='vendors/moment/moment.js')
script(src='vendors/angular-moment/angular-moment.js')
我需要在我的应用程序中使用它 - 如上所述,它在那里工作正常,但是当我运行我以前工作的业力/摩卡测试时,热潮。
我已经尝试将其添加到我的karma.conf.coffee (遗漏了很多细节):
module.exports = (config) ->
config.set
files: [
'bower_components/angular/angular.js'
'bower_components/angular-mocks/angular-mocks.js'
'bower_components/angular-ui-router/**/*.js'
'bower_components/angular-animate/angular-animate.js'
'bower_components/underscore/underscore.js'
'bower_components/moment/moment.js'
'bower_components/angular-moment/angular-moment.js'
### Lots more left out
]
通过打印出angular-moment.js而失败:
http://requirejs.org/docs/errors.html#mismatch
at /Users/stephancom/.../node_modules/requirejs/require.js:141
我也试过在my this angular-moment issue启发的test-main.coffee中添加各种内容也无济于事。
啊,是的,如果重要的话,我会通过凉亭加载角度力矩,但我也是通过npm尝试过的,而且我使用的是这个版本:
"angular-moment": "~0.10.1"
我错过了一些明显的东西,或者是时刻和/或角度时刻不像requirejs或????我对Angular很新,而且我在这一天中一直在努力奋斗一天。