3 ms·
For what it's worth, I use ng-min which will automatically generate the safe syntax when minifying. I like it very much because writing the safe syntax does not
by leddt 13y ago
For what it's worth, I use ng-min which will automatically generate the safe syntax when minifying. I like it very much because writing the safe syntax does not feel "dry" enough to me.
- AdrianRossouw 13y agoI know about ng-min, and that's part of what I'm writing the next article about. But you've now got a situation where it justifies the creation of all this contrib level code that is just not needed if you don't do it the magic way in the first place. You just wouldn't need ng-min or grunt-ngmin or on some level generator-angular to set it up for you. When you take into account all of the code, documentation, github issues, stackoverflow questions etc. this results in, there's no way that this clever hack can be worth it.
- lugg 13y agoI have to say I disagree. It is worth it for sure. The reflection "hack" allows a very clean and fast way to program js apps without needing to bootstrap them with a whole bunch of wiring code you get in things like backbone (also love in any case). The choices you're left with: - write clean easy to read code with a few conventions and use an ng-min call in gulp / grunt or w/e, if you're accustomed to live reload and watch this won't hurt at all. - write in the annotations yourself and deal with it - use something else and put up with having to write all the extra code I've left out the other option, don't minify your code because I think thats a bit of a moot point.
- Cthulhu_ 13y ago> there's no way that this clever hack can be worth it. Well I may not be overthinking it too much, but, Angular's DI is the cleanest way to do DI in Javascript I've seen so far, at least until modules and ES 6 finally become standardized. ng-min solves the duplication one gets from the 'array' notation, as well as that from my previous project which used RequireJS. Doing fulltime Javascript development, I found Angular's DI to be a relief. And yeah, it is a hack, but because Javascript (and all web standards, for that matter) develop so slowly that a standardized, non-hack solution just won't happen in the next couple years. Compare ng-min with polyfills that add support for ES 5 or 6 features to JS projects targeted at older platforms that don't support it yet. Hell, compare it to Coffeescript, which transpliles JS-but-a-bit-nicer to JS.
- albemuth 13y agong-min won't catch some cases, like resolvers or some cases of inline controllers, which were not fun to debug.