Creating an Angular 2 injectable Service

You said a bunch of things here I didn't ask you about.

It's common for people who don't work in teams to not ask questions, and consistently think their opinions without theoretical understandings to be correct. I derive that based on a lot of your reddit history's opinions and how you speak to people.

I may have said things you didn't ask, but you said NOTHING; literally a vast emptiness of sewage in text form.

... because you're not instantiating many classes of objects, Angular is. That's my whole point. That's not a good thing.

If you have a problem with a framework doing things for you, don't use the fucking framework. Simple as that. This isn't rocket science, and it's barely even computer science.

Fetching dependencies from the "global namespace" is not injection, so this is completely irrelevant.

Wrong. How do you think tat dependency got INTO the global namespace? The compiler just magically has your contextual source in a global area for you (which would still be DI)?

Inversion of control doesn't imply autowiring. It doesn't imply singletons. It doesn't imply you have zero control over the objects you feed into the framework.

I never said IoC implies auto-wiring, nor singletons; but rather implied auto-wired DI to be a composite of those patterns. Sorry I didn't spell it out for you. And it does exactly imply in this context you don't have much control over it, that's the whole point of AUTO dep injection; it's AUTO. If you want control, you need to instantiate ad-hoc; meaning injecting a factory.

Anything other than that is a service lookup by name or some other factory-based input.

You're either over thinking this, or under... I'm not sure which, yet.

/r/javascript Thread Parent Link - developer.telerik.com