我需要知道从控制器访问变量“x”
Javascript
function myCtrl() {
var x =1;
}
茉莉花
describe("myCtrlsettings", function() {
var scope ;
var rootScope;
beforeEach(inject(function($rootScope, $controller) {
scope = $rootScope.$new();
ctrl = $controller("myCtrl", {
$scope: scope
});
}));
it(" Test ", function(){
expect(x).toBe(1); // what should I write here??
} );
});
如何从控制器访问变量“x”?
请帮我