1
describe("App defination", function() {
beforeEach(module('app'));
var MainCtrl, scope;
describe("ModuleTwo", function() {
beforeEach(inject(function($controller,$rootScope){
scope= $rootScope.$new();
MainCtrl =$controller('TestCtrl',{ $scope: scope});
}));
it("check scope", function() {
expect(scope).toBeDefined();
});
});
});
我無法訪問該塊中的作用域。它給我錯誤,如「預計未定義到定義」。當我將TestCtrl重命名爲anystring時,它根本不影響茉莉花。爲什麼會發生?如何在業力中注入控制器?