services and dependency injection
Services
Services are simple Typescript classes that provide a specific feature. Services do a single task. The primary purpose of the service is reusability. Instead of writing a function inside a component, separating it into services will make it reusable in another component as well. A Service enables the developers to organize the business sense of an application. The component uses services to do its job.
Also, Services enable the developer to assemble the business logic of the application. The component uses services to do its job. Dependency Injection is used to accordingly run the service in the component so that the component can access the services as and when necessary without any setup.
Dependency injection
Dependency Injection is used to properly initialize the service in the component so that the component can access the services without any setup when necessary.Dependency Injection allows classes with Angular decorators, such as Components, Directives, Pipes, and Injectables, to configure the dependencies that they need.