简体   繁体   English

意外请求:使用grunt-angular-templates进行GET

[英]Unexpected Request: GET using grunt-angular-templates

Trying to use generator-cg-angular. 尝试使用generator-cg-angular。 Testing my directives I get "Error: Unexpected request: GET ecosystem/job/directive/configKey/configKey.html" Which I can fix using html2js, but according to cgross I shouldn't need to. 测试我的指令后,我收到“错误:意外请求:GET生态系统/作业/指令/configKey/configKey.html”,可以使用html2js进行修复,但是根据cgross,我不需要这样做。 He says I just don't have httpBackend configured properly to pass through requests for templates. 他说我只是没有正确配置httpBackend来传递对模板的请求。 Can't figure out what I'm doing wrong. 无法弄清楚我在做什么错。

More info here: https://github.com/cgross/generator-cg-angular/issues/78 更多信息在这里: https : //github.com/cgross/generator-cg-angular/issues/78

Code: 码:

describe('Directive: configKey', function () {
    beforeEach(module('app'));

    var scope, ctrl, new_key;

    beforeEach(inject(function ($rootScope, $controller) {
        scope = $rootScope.$new();
        ctrl = $controller('ConfigKeyCtrl', {
            $scope:scope
        });
        new_key = { edit:true };
        scope.data = angular.copy(data);
    }));

    it('should highlight added keys', function () {
        scope.key.change = 'add';
        scope.saveKey();
        scope.$digest();
        expect(elem.hasClass('alert-success')).toBe(true);
    });
});

My problem was in Karam's configuration. 我的问题出在Karam的配置上。 ngtemplate's out file was not being included in Karma's file list. ngtemplate的out文件未包含在Karma的文件列表中。 Simply add '<%= ngtemplates.main.dest %>' to karam:options:files 只需将'<%= ngtemplates.main.dest%>'添加到karam:options:files

files:                [
    '<%= dom_munger.data.appjs %>',
    '<%= ngtemplates.main.dest %>',  // Added this one
    'bower_components/angular-mocks/angular-mocks.js',
    'directive/**/*.html',
    createFolderGlobs(['*-spec.js'])
],

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM