Now that we learned how data was shared among classes before services and that this wasn’t very DRY or scalable, let’s learn how to use services for dependency injection.

This is the second piece of a two-part article about dependency injection. In the first, we learned why we would want to use services in Angular. In this post, we will look at how to use them.


To be able to follow through in this article’s demonstration, you should have:

  • An integrated development environment like VS Code
  • Node version 11.0 installed on your machine
  • Node Package Manager version 6.7 (it usually ships with Node installation)
  • Angular CLI version 8.0 or above
  • The latest version of Angular (version 12)

#angular #javascript #web-development

How to Use Services in Angular
2.35 GEEK