2

アンダースコアを挿入しているangularjsファクトリーがあり、アプリケーションは正常に動作していますが、それにジャスミンテストケースを書き込もうとすると、アンダースコアプロバイダーが見つからないというエラーが発生します。

angular.module("sample")
.factory("example", example);
 example.$inject = ["$document", "$compile", "$rootScope", "$timeout", "$q", "underscore"];
function example($document, $compile, $rootScope, $timeout, $q, _) {

}

私のモジュールは次のように定義されています

(function(){
angular.module(samlple,[]);
})();

私のテストケースは次のとおりです

beforeEach(module('sample'));
beforeEach(module('ionic'));
beforeEach(inject(function ($document, $compile, $rootScope, $timeout,underscore,example) {

}

その与えるエラー Error: [$injector:unpr] Unknown provider: underscoreProvider <- underscore

4

2 に答える 2