I am having a problem were I have a controller in my app which I use like <div ng-controller='LogbookEditCtrl'> </div> and this controller has a $element provider in it which I need to modify the element.
describe('LogbookEditCtrl', function(){
'use strict';
beforeEach(module('logbooks.edit'));
it('should create "logbook" model', inject(function($controller) {
var scope = {},
ctrl = $controller('LogbookEditCtrl', {$scope: scope}); //THIS EXPLODES BECAUSE IT SAYS THE $element PROVIDER WAS NOT FOUND, because there is no html element of course..the controller is being created on its own.
}));
});
I have tried something like the following, but it again says the $element provider was not found :
beforeEach(inject(function(_$element_) {
var element = compile('<div></div>');
$element = element;
}));
Aucun commentaire:
Enregistrer un commentaire