4 ms·
> no namespacing You don't really need to for angular development. Namespacing Javascript is a cargo cult practice brought over from more traditional OO langua
by warfangle 13y ago
> no namespacing
You don't really need to for angular development. Namespacing Javascript is a cargo cult practice brought over from more traditional OO languages.
> no encapsulation
There is if you want it to be. You're especially encouraged to separate the concerns of the DOM in directive services, for example.
> no build/file management
That's kind of up to you, isn't it? You can run with grunt/require if you want a headache, grunt or gulp / uglify if you want easy, you can run with gulp/browserify if you want the new cool ...
- GeneralMayhem 13y agoI agree that you don't generally need namespacing for JS, but you do need namespacing when everything is referred to by name! If the only way to refer to a controller is that it's called "MainController," with all other information about where it came from and what it does completely lost when it gets added to the registry, then you have to have some way to deal with naming conflicts. Angular... just... doesn't. The Angular injection module is global variables by a different name, and there's no way not to use it. Hell, at least globals you can work around with a no-conflict hack. Compare to Backbone, which is not a perfect framework by any stretch, but with Require it does dependency management and modularization really, really right. Also compare to Java, which similarly forces classes to be referred to by one canonical name, but deals with it via the org.apache.commons... spam. You're right about services providing encapsulation. I still wind up with a lot of awkward situations where directives can't work without knowing something about their parent scope. It's possible that's more my problem because it's getting less frequent as I abuse ng-model more and more, but also remember that isolate scope, up until very recently, worked in an incomprehensibly stupid way [1]. >grunt or gulp / uglify if you want it easy Eh... not really that easy. At least, not if you want to anything more sophisticated than concat together every .js file in sight. Require, for all its problems and relative-path headaches, at least makes it dead simple to run in development without having to remember to either add another file to the list or wait for a rebuild every time you change something. [1]: https://github.com/angular/angular.js/commit/909cabd36d779598763cc358979ecd85bb40d4d7 https://github.com/angular/angular.js/commit/909cabd36d77959...