Angular
Building a CRUD Application with Angular & ASP.Net Core - Services in Angular GET
  •  

Services in Angular Overview

PRO

Services in Angular

In this video we took a look at services in Angular. Services are classes defined to complete a specific purpose. A fully built out Angular application can have MANY services.

Examples of what a servcice might do would be:

  • Fetching data from a server via http (this is what we will be implementing)
  • Validating user inputs
  • Logging errors or events to analytics

Why Services?

Services provide modularity. When done right we have small purpose designed services that we can access in our components. We get access to our services by injecting them. We only need to inject the services that we need inside of our components. A lot of our business logic will live inside of services and this is important. Any duplicate code we see in multiple components can probably be extracted to a services and injected in where necessary.