Answer the question
In order to leave comments, you need to log in
How to get scope or $ctrl in angularjs tests?
How to get a scope or $ctrl or at least something from a component (its controller) in a test?
app.component('authComponent', {
templateUrl: 'app/auth/auth.html',
controller: authCtrl
});
function authCtrl()
var $ctrl = this;
this.data = [1,2,3];
}
describe('component: heroDetail', function() {
var $componentController;
beforeEach(module('globalApp'));
beforeEach(inject(function(_$componentController_) {
$componentController = _$componentController_;
}));
it('should expose a `hero` object', function() {
var ctrP = $componentController('authCtrl');
expect(ctrP.data).toBeDefined();
});
});
Unknown provider: authCtrlDirectiveProvider <- authCtrlDirective
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question