Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decorators not properly annotated #43

Closed
danielmcormond opened this issue Jul 24, 2013 · 7 comments
Closed

Decorators not properly annotated #43

danielmcormond opened this issue Jul 24, 2013 · 7 comments

Comments

@danielmcormond
Copy link

I believe the current implementation for annotating AngularJS decorators might be wrong.

It looks like the current decorator test in simple.js:112 isn't realistic.

For example, if you actually used this syntax in an app:

angular.module('myMod', [])
  .decorator('myService', function (dep) {});

You would get this error:

Uncaught TypeError: Object #<Object> has no method 'decorator'

I believe a valid decorator definition looks more like this:

angular.module('myMod', [])
  .config(function($provide) {
    $provide.decorator('myService', function($delegate) {});
  });

In this case, the $delegate dependency is not being correctly annotated.

Unfortunately, I don't have time to work on a PR right now. But I at least wanted to create an issue in case others experience this and are searching. 😄

@mgcrea
Copy link

mgcrea commented Aug 22, 2013

👍 same issue here

@btford
Copy link
Owner

btford commented Aug 28, 2013

confirmed; this was a silly error on my part.

@marcalj
Copy link

marcalj commented Nov 23, 2013

I'm not completelly sure if this issue is related in fact $provide.factory isn't ngminfied.

    .config(function ($provide, $routeProvider) {
        var resolve = {
            auth: 'authResolve'
        };

        $provide.factory('authResolve', function (AuthService) {
            return AuthService.check();
        });

becomes:

.config([
  '$provide',
  '$routeProvider',
  function ($provide, $routeProvider) {
    var resolve = {
        auth: 'authResolve',
        cache: 'cacheResolve'
      };
    $provide.factory('authResolve', function (AuthService) {
      return AuthService.check();
    });

authResolve is not parsed correctly.

@kirill-konshin
Copy link

Still does not work:

$provide.decorator("$exceptionHandler", function($delegate, $injector, $log) {

is skipped...

@steve8708
Copy link

+1 on this, would be really nice!

@mike1808
Copy link

mike1808 commented Jul 3, 2014

Met this issue today
+1

@eddiemonge
Copy link
Collaborator

Try using ng-annotate as that will replace ng-min soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants