angular + TS + jasmine + ng-html2js ='无法实例化模块模板'。如何实例化模板?它在哪里形成?

时间:2016-11-23 14:25:03

标签: angularjs typescript jasmine ng-html2js

尝试在单独的文件中使用模板对angular' s 1指令进行单元测试。使用jasmine和ng-html2js来存储$ templateCache中的html模板。在没有SystemJS的项目中,可以使用:

beforeEach(module('MyStupidModule', 'templates'))

其中,模板 - 位于' carma.conf.js'

    preprocessors: {
        'Content/templates/**/*.html' : ['ng-html2js']
    },

    ngHtml2JsPreprocessor:{
        moduleName: 'templates'
    },

它运作得很好。

但是使用SystemJS,我们现在必须实例化这两个模块才能使它们可以访问。模拟我自己的模块很简单,

...
        mockAngularModule('MyStupidModule');
        // angular.mock.module('MyStupidModule');
        angular.mock.module('store', 'templates');
..

但我在哪里可以实例化这个'模板'模块?现在它抛出

  

错误:[$ injector:modulerr]无法实例化模块模板   to:错误:[$ injector:nomod]模块'模板'不可用!

0 个答案:

没有答案