I followed the recommendation in option 2 of the accepted answer to a question on stackoverflow about unit testing directive controllers in Angular without making the controller global. You can find the original post here.
Here is a snippet of my code:
(function () {
function myCtrl($scope) {
//All my controller code.
};
myAppModule.directive('myDirective', function($compile, $timeout) {
return {
restrict: 'E',
replace: true,
controller: myCtrl,
compile: function(tElement, tAttrs, transclude) {
return {
post: function(scope, element, attrs) {
//more code and stuff.
}
}
}
});
})();
I have a simple question; since the controller is not defined within the scope of the module, how can I load it in my test file?