cgarvis / angular-toggle-switch

AngularJS Toggle Switch
http://cgarvis.github.io/angular-toggle-switch
MIT License
160 stars 124 forks source link

array format injection #30

Closed alexahn closed 10 years ago

alexahn commented 10 years ago
controller: function($scope) {

would be better off as:

controller: ['$scope', function($scope) {

because uglification of javascript will break this library (and whatever project that uses it).

cgarvis commented 10 years ago

I use ngmin to handle this for me. It's part of the build process.

alexahn commented 10 years ago

You do understand that anyone who uses this library will have to know to run ngmin over this library? Usually you aren't expected to run ngmin over vendor files (because it's assumed that it's written in the array format).

cgarvis commented 10 years ago

Minified version is part of the package. You only need to use the un-minified if you are doing development on it.

alexahn commented 10 years ago

A lot of people like to have error messages that are sensible. Using a minified vendor file during development is not comforting.

cgarvis commented 10 years ago

Are you getting error messages from angular-toggle-switch?

alexahn commented 10 years ago

No, but it could happen. Do what you want; I am merely bringing up the point that people will have to know to use the minified version if they are uglifying their entire application. Otherwise they will be met with some hard to decipher provider injection error, which if they are fortunate enough will be able to figure out by combinatorially removing vendors. For people who build SPAs, uglifying the entire application (with vendors included) as a last step is not that uncommon. That being said, some people prefer to use the un-minified vendor files during development, in case they run into any errors from these libraries. If you don't want to make this change, then don't, but I don't see what you have to lose by making it. If your source code (by declaration) can be resilient to minification/uglification, then why not do it? It seems like a best practice in the angular community to do array format injection.

iksose commented 9 years ago

+1

giulioprovasi commented 9 years ago

+1, searched for about an hour why I get injector error in production and not in development (uglification vs not)