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

ngmin fails to annotate a declaration if it follows an annotated one #50

Closed
nkanand4 opened this issue Sep 18, 2013 · 4 comments
Closed
Labels

Comments

@nkanand4
Copy link

Annotation does not work for the controller if it follows an annotated factory.

angular.module('app')
  .factory('two', ['$scope', function($scope) {
    // ...
  }]).
  .controller('one', function($scope) {
    // ...
  });
@nkanand4 nkanand4 reopened this Sep 27, 2013
@fuksito
Copy link

fuksito commented Dec 12, 2013

I confirm this. just got into this problem in my project. If there are mixed injection annotation in code, all the injections after the explicit syntax is used the functions with implicit injection won't be turned in to explicit form.

@facboy
Copy link

facboy commented Jan 5, 2014

I have found this as well. It seems the bug only happens if you chain declarations off the initial module call. eg, as stated in the OP, this will not work:

angular.module('app')
  .factory('two', ['$scope', function($scope) {
    // ...
  }])
  .controller('one', function($scope) {
    // ...
  });

and I've found that this will not work:

var mod = angular.module('app')
  .factory('two', ['$scope', function($scope) {
    // ...
  }]);
mod.controller('one', function($scope) {
    // ...
  });

but that this will:

var mod = angular.module('app');
mod.factory('two', ['$scope', function($scope) {
    // ...
  }]);
mod.controller('one', function($scope) {
    // ...
  });

@eggers
Copy link

eggers commented Mar 19, 2014

Does it also fail for when there is a chain where the first one in the chain doesn't require annotation?

Because I'm seeing this fail to ngmin properly:

angular.module('app')
  .provider('one', function() {
    // ...
  }])
  .config(function(oneProvider) {
    // ...
  });

@eddiemonge
Copy link
Collaborator

Please try https://github.com/olov/ng-annotate. ngmin is now deprecated: #93

If your issue isn't resolved there please open an issue at https://github.com/olov/ng-annotate/issues

If you really want ngmin to fix this issue, feel free to fork it and use that.

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

No branches or pull requests

5 participants