vendredi 29 mai 2015

'myApp.controller is not a function' error in Jasmine

I'm getting the following error in the js console log when attempting to assign the controller to 'myCtrl' variable in a jasmine test: 'myApp.controller is not a function'

In the controller itself, the controller is defined as the following and this is what's triggering the error I mentioned:

myApp.controller('myCtrl', ...

And this is how I'm trying to access the controller in my spec file:

beforeEach(function() {
    module('myApp');
});

it('tests the controller', inject(function($controller) {
    var myCtrl = $controller('myCtrl');
}));

Any idea why it's still throwing this error? Seems to be a missing dependency but not sure where..

Aucun commentaire:

Enregistrer un commentaire