I was working on a practical project using Angular 8, where I was creating a service and thinking more about how to implement SOLID principles. I decided to have an interface to define my service and a class to implement the logic. Everything was okay with that design, but a question came to my mind, “How can I implement dependency injection with my Angular component?”
In this example, I am going to use an abstract class, Let’s create an abstract class, named IGreetingsService
. This will be used as an Interface with a greeting method.
I was working on a practical project using Angular 8, where I was creating a service and thinking more about how to implement SOLID principles. I decided to have an interface to define my service and a class to implement the logic. Everything was okay with that design, but a question came to my mind, “How can I implement dependency injection with my Angular component?”
In this example, I am going to use an abstract class, Let’s create an abstract class, named IGreetingsService. This will be used as an Interface with a greeting method. […]