Still learning this myself so can't exactly say this is best practices, but
it works
describe('Controller Unit Test', function(){
beforeEach(function(){
module('myModule');
})
var $rootScope, $controller
beforeEach(inject(function($injector) {
$rootScope = $injector.get('$rootScope');
$controller = $injector.get('$controller');
}));
var controller="";
it('Should be a controller', function() {
// get the controller
controller = $controller('fooCtrl', {'$scope': $rootScope});
// test it
expect(controller.sayMsg()).toBe('hello')
});
});
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.