0
控制器测试套件一个(主控制器):两个控制器的测试套件,一个给予“错误:[NG:AREQ]参数‘modalController’不是一个函数,得到了未定义”
describe("RTL cache viewing utility main controller test suite", function() {
var $rootScope, mainCtrl;
beforeEach(module('app'));
beforeEach(inject(function ($controller, $rootScope, $compile, $q) {
mainScope = $rootScope.$new();
ctrl = $controller('mainCtrl', {
$scope: mainScope
});
}));
后跟另一个描述和it
s。这个工作正常。
其次测试套件,为我的模态控制器:
describe("RTL cache viewing utility modal controller test suite", function() {
var $rootScope, modalController;
beforeEach(module('app'));
beforeEach(inject(function ($controller, $rootScope, $compile) {
mainScope = $rootScope.$new();
ctrl = $controller('modalController', {
$scope: mainScope
});
}));
接着又描述和一个it
。
二控制器抛出这个错误:Error: [ng:areq] Argument 'modalController' is not a function, got undefined
声明的主控制器:
var app = angular.module("app", ["agGrid", "ui.bootstrap"]);
angular.module("app").controller("mainCtrl", ["$scope", "$timeout", "dateFilter", "$http", "shareDataService", "getDataService", "$q", function ($scope, $timeout, dateFilter, $http, shareDataService, getDataService, $q) {
//stuff
}]);
模态控制器:
angular.module("app").controller("modalCtrl", ["$scope", "shareDataService", "getDataService", function ($scope, shareDataService, ngDialog, getDataService) {
//stuff
}]);
谢谢!多年来一直拉着头发。 – xeon48