Use Angular Factory Providers with dependencies

Share this video with your friends

Send Tweet

This lesson discusses when and how to add dependencies, resolved by Angular’s DI, to factory providers. The example used in this lesson builts upon the previous lesson on understanding factory providers.

Raphi
Raphi
~ 8 years ago

What is gained by adding ConsoleService?

I guess you are just trying to demonstrate using provider dependencies, but could have had a better example nonetheless

Jorge Arévalo
Jorge Arévalo
~ 8 years ago

In the angular docs states that:

Technically, the @Injectable()decorator is only required for a service class that has its own dependencies.

But in your example, LogDebugger has a dependency on ConsoleService. And works event when you're not using @Inyectable decorator at all.

How is it possible? Or Am I misunderstanding something?