3 ms·
> Does two-way databinding have to be so awkward? The verbose parts have nothing to do with the data-binding. The dependency injection is there for testability
by JDDunn9 12y ago
> Does two-way databinding have to be so awkward?
The verbose parts have nothing to do with the data-binding. The dependency injection is there for testability (https://docs.angularjs.org/guide/unit-testing https://docs.angularjs.org/guide/unit-testing), you have to use array notation because JS changes variable names upon minification. The rest is just objects being used to set up options.
- andybak 12y agoJS doesn't change variable names upon minification - minifiers do. For the dubious benefit of saving probably less than 5-10% of a transfer we've decided it's worth repeating ourselves pointlessly. Fix the minifiers.
- ahoge 12y ago> Fix the minifiers. Most minifiers have a switch for that. E.g. UglifyJS2's is "-m"/"--mangle". YUI Compressor's is "--nomunge". By the way, this stuff looks a lot nicer with AngularDart or Angular 2.x.
- Cthulhu_ 12y agoArray notation is only required if you're not actually up to date on modern build tooling - ng-annotate [0] will automatically generate array notation DI statements in most of your application code. [0] https://github.com/olov/ng-annotate https://github.com/olov/ng-annotate