Injecting Service into another Service | Services & Dependency Injection | Angular 12+

preview_player
Показать описание
In the beginning of this section we learned that we can use services to communicate between components, directives and service. We have already learned how to inject a service dependency to a component class.

In this lecture, lets learn how to inject a service dependency into another service. This lecture is a continuation to the previous lecture.
Рекомендации по теме
Комментарии
Автор

Finally, here we are. You got there at the very end of this video. The @injectable decorator. However, it was good to watch the all process of your demo. Many thanks.

jjuliefrance
Автор

Thanks for posting the most clear and easy to undrestand explanation.

khalidsultani
Автор

The best best best explanation I've ever watched.

annoor
Автор

@Injectable({
providedIn: 'root'
})

This is another way to inject the service into another service instead of providing in Component or App module. If you are creating the service through Angular CLI then by default, it will be added to the service.

maneshwar
Автор

You explain everything real good! Thank you for the videos!

TheGuy
Автор

I understood the concept you explain about Injecting a service into another service, but I didnt understand why you inject the logger service in the component? As I see you injected the logger service without any reason, as the component is not directly communicating with the logger service.

OutSystemsJourney
Автор

Why do we need to provide an instance of logger service separately in app.component.ts file, when logger service is not used in app.component.ts at all. Can't user service create a instance of logger service when user service's instance is created. and also it seems redundant.

akashsolanki