模块“视频”无法使用

时间:2016-04-28 22:28:25

标签: angularjs node.js angular-fullstack

我使用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 个答案:

答案 0 :(得分:1)

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

PlayClipAtPoint
相关问题