3 ms·
Angular's dependency injection is literally magic. Someone who has never used javascript before would probably have the advantage over a seasoned js-pro when re
by chrisfarms 13y ago
Angular's dependency injection is literally magic. Someone who has never used javascript before would probably have the advantage over a seasoned js-pro when reading the code.
That said; once I realised what it is doing, I quite like it and it has led to some of the cleanest client-side code I've written.
- aidos 13y agoAs you say - once you know what's going on it's not that magical at all. It literally looks at the text source for you function definition and injects the arguments you ask for. Certainly, when I first looked at it I felt the docs didn't explain that little nugget so you sort of wonder how your arguments are injected. More of a doc problem than an obfuscation issue, I think.
- ianstormtaylor 13y agoCareful, that's a pretty easy (read: tautological) way to justify all magic.
- cpprototypes 13y agoI think this depends on a developer's background before using AngularJS. I've used Spring (Java DI framework) for a while and AngularJS DI was easy to understand. However, the first time I was introduced to the DI concept, it took a while for me to understand it. Some of the complaints about the difficulty of AngularJS DI could be because for some JS developers it's the first time they've been introduced to the concept.