2016-04-28 23 views
0

私はジェネレータとしてAngular-fullstackを使用しています。私はビデオと呼ばれるルートを生成しました。しかし、私が不平のテストを実行すると、クライアントは私にこのエラーを表示します -モジュール 'video'は利用できません

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 

テストコードは、角型のフルスタックによって生成されます。ここ

'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

初めて角張ったフルスタックで作業しているときに同じ問題が発生しました。私はあなたのコントローラのコンポーネント名としてビデオを持っているあなたのテストの原因を説明したところで、コンポーネント名を 'video'に変更しなければならないと思います。

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

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

両方のコンポーネント名を 'VideoComponent'に変更すると動作しますか? – recharDS

+0

そうだと思います。私はそれが働くべきであることを意味する..... – JP1248

+0

は 'ビデオに働いて両方働いた。私はもう1つをチェックさせてください。 – recharDS

関連する問題