btford / ngmin

**deprecated** AngularJS Pre-minifier –> use ng-annotate –>
https://github.com/olov/ng-annotate
860 stars 42 forks source link

Annotations are not added in modules with a constant definition at first place #32

Closed mlegenhausen closed 11 years ago

mlegenhausen commented 11 years ago

Working:

angular.module('foo', [])

.service('someService', function(someDep) {
  ...
})

.constant('someConstant', {
  ...
})

;

Not working:

angular.module('foo', [])

.constant('someConstant', {
  ...
})

.service('someService', function(someDep) {
  ...
})

;

In the first code example the service definition gets annotated, in the second not. This happens with the other functions like factory, provider, run aso too.

ajoslin commented 11 years ago

+1, just encountered this myself.

BinaryMuse commented 11 years ago

I'm not able to reproduce this on master:

$ cat test.js
angular.module('foo', [])

.constant('someConstant', {
  //
})

.service('someService', function(someDep) {
  //
})

;

$ ./bin/ngmin < test.js
angular.module('foo', []).constant('someConstant', {}).service('someService', [
  'someDep',
  function (someDep) {
  }
]);
;
mlegenhausen commented 11 years ago

With the latest version of ngmin the problem is fixed. I get the same result with version 0.3.6. I encountered the problem with the grunt-ngmin task. Please update the ngmin dependency.