我一直在浏览有关此问题的许多问题,但我仍然没有弄清楚。(vojtajina/ng-directive-testing 也没有多大帮助)。
业力.conf.js
preprocessors: {
'app/components/partials/*.html': 'ng-html2js'
},
ngHtml2JsPreprocessor: {
stripPrefix: 'app/',
moduleName:'flickrNgSpaApp'
},
files: [
'app/**/*.js',
'app/components/**/*.js',
'test/mock/**/*.js',
'test/spec/**/*.js',
'app/components/partials/*.html'],
plugins: [
'karma-ng-html2js-preprocessor'
],
templateUrl: 'components/partials/thumbnails.html',
和我的测试
describe('Directive: thumbnailsDirective', function () {
var $compile, $rootScope, template;
beforeEach(module('flickrNgSpaApp', 'components/partials/thumbnails.html'));
beforeEach(inject(function(_$rootScope_, _$compile_, $templateCache)
template=$templateCache.get();
$templateCache.put());
...
错误:[$injector:modulerr] 无法实例化模块组件/partials/thumbnails.html..
任何人请!我做错了什么?