olov / ng-annotate

Add, remove and rebuild AngularJS dependency injection annotations
MIT License
2.03k stars 150 forks source link

Missing rule #233

Closed BrodaNoel closed 8 years ago

BrodaNoel commented 8 years ago

In this code:

angular.module('xxxx')
    .provider('$foo', function foooo() {
        var loadTemplateFunction = function($route, $test) {
            return $test.load({
                customerApiKey: $route.customerApiKey,
                hash: $route.hash,
                lang: $route.lang,
            });
        };
        this.bar = {
            template: '<div></div>',
            controller: 'bar',
            resolve: {
                templatesLoaded: loadTemplateFunction,
            },
        };

I should add this code:

angular.module('xxxx')
    .provider('$foo', function foooo() {
        var loadTemplateFunction = ['$route', '$test', function($route, $test) { // <<< here!
            return $test.load({
                customerApiKey: $route.customerApiKey,
                hash: $route.hash,
                lang: $route.lang,
            });
        }];

        this.bar = {
            template: '<div></div>',
            controller: 'bar',
            resolve: {
                templatesLoaded: loadTemplateFunction,
            },
        };

Initial issue: https://github.com/mgol/grunt-ng-annotate/issues/44

olov commented 8 years ago

Not planning to support that, use "ngInject" as described in the README.