Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Impossible to inject providers into Module.provider() when array-style DI-annotations are used #1452

Closed
@pkozlowski-opensource

Description

@pkozlowski-opensource

Problem description

It is impossible to define a provider that depends on another provider in the minified version of an application. The following code:

var myApp = angular.module('myApp', []).provider('crudRouteProvider', ['$routeProvider', function(e) {

    this.doSthWithRouteProvider= function(pathPrefix) {
        //do something with $routeProvider here
    };

    this.$get = function() {
        return {};
    };
}]);

will fail with Uncaught Error: Provider crudRouteProvider must define $get factory method. from myApp. Here is the jsFiddle: http://jsfiddle.net/pkozlowski_opensource/FGkdD/1/

Expected behavior

The unminified version works correctly, here is the jsFiddle: http://jsfiddle.net/pkozlowski_opensource/cHHJJ/
The minified version should behave exactly the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions