Dependency injection in Angular | Services & Dependency Injection

Описание к видео Dependency injection in Angular | Services & Dependency Injection

In the last lecture we learned that creating an instance of a service by our own is not a good practice. Instead we can ask angular to inject an instance of a service in the component where we want to use it. This is called as dependency injection.

Dependency injection is a concept where another source injects a dependency of a class to that class, making the class loosely coupled with dependent class.

Let's leran with an example, how we cen inject a dependency to a component in this lecture.

Комментарии

Информация по комментариям в разработке