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

Support for components wrapped in IIFE #42

Closed
srigi opened this issue Jul 10, 2013 · 2 comments
Closed

Support for components wrapped in IIFE #42

srigi opened this issue Jul 10, 2013 · 2 comments

Comments

@srigi
Copy link

srigi commented Jul 10, 2013

There is a support for ngmining of refenced modules as mentioned in doc:

var myMod = angular.module('myMod', []);
myMod.service('myService', function($scope) {});

By using this method myMod leak into global scope (most AngularJS apps don't use AMD, mine too), so I'm not using it. I also don't use chained way of source, cos I don't like it.

However, as I'm using CoffeeScript, I explored really nice way of isolating modules like this:

do(module = angular.module('myMod', [])) ->
  module.service('myService', ($scope) ->
    # do something

This yields nicely isolated component with this JS code:

(function (module) {
  return module.service('myService', function ($scope) {
    // do something
  });
}(angular.module('myMod')));

Of course this is not recognized by ngmin. I would much appreciate if ngmin will support this syntax. That do call in CfS looks like namespacing schema implemented by Angular's module system, so I really like it.

@btford
Copy link
Owner

btford commented Jul 13, 2013

I'm not especially keen on implementing support for this myself, but I'd be willing to review and possibly merge a PR for the feature.

@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
None yet
Projects
None yet
Development

No branches or pull requests

3 participants