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 javascript enclosures? #89

Closed
thardy opened this issue Apr 12, 2014 · 3 comments
Closed

Support for javascript enclosures? #89

thardy opened this issue Apr 12, 2014 · 3 comments

Comments

@thardy
Copy link

thardy commented Apr 12, 2014

I'm trying to follow better javascript patterns espoused by "the greats" like Douglas Crockford, and I found that using enclosures breaks ngmin..

(function(app) {
    app.controller('SomeController', function ($scope) {
    });
}(angular.module("someModule")));

It never sees the controller declaration and leaves it alone. Should this be working?

@btford
Copy link
Owner

btford commented Apr 14, 2014

I'm not keen on this. I don't think this pattern buys you anything.

Try ngmin with --dynamic.

@eddiemonge
Copy link
Collaborator

You can get the same enclosures doing it this way:

(function(angular) {
    angular.module("someModule").controller('SomeController', function ($scope) {
    });
}(window.angular);

but really the enclosure could/should(?) be added by your build system after concatenating your code

@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