2016-04-28 51 views
0

我正在使用Angular-fullstack作为生成器。我产生了一个叫做视频的路线。但是当我运行grunt测试:客户端我给我看这个错误 -模块“视频”不可用

Error: [$injector:nomod] Module 'video' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. 
    http://errors.angularjs.org/1.5.3/$injector/nomod?p0=video 

测试代码是由angular-fullstack生成的。这里是我的测试代码 -

'use strict'; 

describe('Component: VideoComponent', function() { 

    beforeEach(module('video')); 

    var VideoComponent, scope; 

    beforeEach(inject(function ($componentController, $rootScope) { 
    scope = $rootScope.$new(); 
    VideoComponent = $componentController('VideoComponent', { 
     $scope: scope 
    }); 
    })); 

    it('should ...', function() { 
    expect(1).to.equal(1); 
    }); 
}); 

这里是我的测试我的控制器代码 -

'use strict'; 
(function(){ 

class VideoComponent { 
    constructor() { 
    this.message = 'Hello'; 
    } 
} 

angular.module('video') 
    .component('video', { 
    templateUrl: 'app/video/video.html', 
    controller: VideoComponent 
    }); 
})(); 

谁能告诉我什么是错在这里。提前致谢!!

回答

1

我在第一次使用angular-fullstack的时候遇到了同样的问题。我认为您必须将组件名称更改为'视频',因为您在测试中描述了视频作为控制器中的组件名称。

describe('Component: video', function() { 

    beforeEach(module('video')); 
    ....... 
    ....... 
+0

它会工作,如果我更改两个组件名称'VideoComponent'? – recharDS

+0

我这么认为。我的意思是它应该工作..... – JP1248

+0

更改为'视频'工作。让我检查另一个。 – recharDS