我在Angular.js中比较新,所以我尝试了所有其他解决方案,但它总是抛出一个错误assetDetailController不是一个未定义的函数..任何建议我在这个网站上尝试了所有可能的解决方案..
describe('asset detail Controller',
function () {
describe('assetDetailController',
function () {
var scope;
var rportService;
var controller;
var $q;
var deferred, assetId, rootScope;
var httpMock, data;
beforeEach(module('app'));
// inject the required services and instantiate the controller
//beforeEach();
describe('asset detail Controller 2',
function () {
deferred = null;
//beforeEach();
//beforeEach(angular.mock.inject(function ($q) {
//}));
beforeEach();
it('test to be called with',
function ( done) {
angular.mock.inject(function ($rootScope, $controller, reportService, $q, $httpBackend) {
scope = $rootScope.$new();
rportService = reportService;
controller = $controller('assetDetailController',
{
$scope: scope,
assetId: assetId,
reportService: rportService,
rootScope: $rootScope
});