babel-plugin-angularjs-annotate icon indicating copy to clipboard operation
babel-plugin-angularjs-annotate copied to clipboard

remove/reuse existing $inject expressions

Open schmod opened this issue 9 years ago • 0 comments

The following test-case from the original ng-annotate does not yet pass with the Babel plugin:

Ctrl1.$inject = ["serviceName"];
// @ngInject
// already has .$inject array (before function definition)
function Ctrl1(a) {
}

// @ngInject
// already has .$inject array (after function definition)
function Ctrl2(a) {
}
Ctrl2.$inject = ["serviceName"];

function outer() {
    MyCtrl["$inject"] = ["asdf"];
    return {
        controller: MyCtrl,
    };

    // @ngInject
    function MyCtrl(a) {
    }
}

We need to detect existing $inject statements, and remove and/or correct them. (If there's a conflict, we should probably also print a warning)

schmod avatar Aug 04 '16 18:08 schmod