2014-11-06 14 views
2

我想調試我的業力設置不是如何預處理我的指令模板。噶ng-html2js預處理程序不生成模塊

我希望通過設置moduleName: foo我可以很容易地搶在Chrome中調試控制檯模塊,看看這是怎麼回事,但在調試試圖angular.module('foo')返回no module found錯誤導致我相信這個問題是其他地方。

我也嘗試將html預處理器更改爲一些無意義的字符串,希望業力會拋出一個錯誤,但事實並非如此。這導致我認爲這個問題可能是因爲我的模板沒有正確的路徑,但是如果我將該路徑更改爲其他路徑,它確實會拋出錯誤no files match this path

有沒有任何調試選項/方法,我錯過了?有什麼方法可以記錄ng-html2js中進出的內容嗎?

這是我karma.conf.js

module.exports = function(config) { 
    config.set({ 
    plugins: [ 
     // these plugins will be require() by Karma 
     'ng-html2js', 
     'jasmine', 
     'karma-jasmine', 
     'karma-phantomjs-launcher', 
     'karma-chrome-launcher' 
    ], 
    basePath: '', 
    // frameworks to use 
    frameworks: ['jasmine'], 
    files: [ 
     APPLICATION_SPEC, 
     '../app/assets/javascripts/image-crop.js', 
     '../app/assets/javascripts/angular/**/*.js', 
     '../spec/javascripts/**/*_spec.js', 
     "../public/templates/**/*.html" 
    ], 
    exclude: [ 
     './app/bower_components/angular/angular.min.js' 
    ], 
    reporters: ['progress'], 
    preprocessors: { 
     '**/*.html': ['ng-html2js'] 
    }, 
    ngHtml2JsPreprocessor: { 
     stripPrefix: 'public/templates', 
     moduleName: 'foo', 
    }, 
    port: 9876, 
    colors: true, 
    logLevel: config.LOG_INFO, 
    autoWatch: true, 


    browsers: ['PhantomJS', 'Chrome'], 
    singleRun: false 
    }); 
}; 

回答

1

這顯然是與尋路的問題,因爲當我添加的基本路徑basePath: '../'我的人緣配置和調整,我files:路徑,預處理器工作正常。

2

有沒有我錯過的調試選項/方法?有沒有 的方法來記錄ng-html2js的內容?

是的; karma start --log-level debug將顯示DEBUG [preprocessor.html2js]條目。但是,如果files路徑和preprocessors模式正確,則只會獲得這些條目。