我有一个基本的1.5角度组件,看起来像这样:
angular
.module('app')
.component('techs', {
templateUrl: 'app/techs/techs.html',
controller: TechsController
});
而且我只想模拟这个组件而不是整个应用程序,因为可以模拟应用程序的angular.mock.module('app')
每个组件。有办法吗?
我试过了,angular.mock.module('techs')
但是发生了这个错误:
Failed to instantiate module techs due to:
Module 'techs' is not available! You either misspelled the module name or forgot to load it
您应该通过$ componentController注入组件。
Forex: component = $componentController('Component', {yourscope}, {yourbindings});
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句