Alright, I have a solution. If I separate out the controller definition 
function like this:

    var app = angular.module('MyApp',[]),
         myControllerFn = function($scope, $q) {
             $scope.myFn = function () {};
         };
    app.controller('MyController', ['$scope', '$q', myControllerFn]);

Then I can get the injected bits thusly:

     var injectedBits = angular.injector().annotate(myControllerFn);

If I could somehow get the controller definition function from the 
controller object itself, then it wouldn't be necessary to separate out the 
definition function. But this'll meet my needs.

Thanks,

-michael

On Sunday, April 13, 2014 1:42:39 PM UTC-7, Michael Kelly wrote:
>
> I'd like to be able to verify what's being injected into my controller, 
> and further, to use that information in additional tests.
>
> I'd expect to be able to do something like this:
>
>     var app = angular.module('MyApp',[]);
>     app.controller('MyController', ['$scope', '$q', function($scope, $q) {
>         $scope.myFn = function () {};
>     }]);
>
>     describe('MyController', function () {
>
>         it('should require $scope and $q', function () {
>             
> expect(app.controller("MyController").requires).toBe(['$scope', '$q']);
>         });
>
>     });
>
> But when I execute this test I get:
>
>     Expected [  ] to be [ '$scope', '$q' ]
>
> Any help would be appreciated,
>
> -michael
>

-- 
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.

Reply via email to