# Services, HTTP and Observables

Services hold the work that does not belong to one component, like calling your Web API. You will create services, call APIs with HttpClient, work with observables, and share data between components.

Updated: November 18, 2026

## [Angular Services](https://www.ask-codey.com/courses/csharp-full-stack-bootcamp/topics/angular-services)

1. [Services and inject()](https://www.ask-codey.com/lessons/angular-services-services-and-inject) (Apprentice): A service is a class for work that isn't about showing anything, such as calculations or calling an API. Mark it @Service(), and any component gets the one shared instance with inject(), like dependency injection in ASP.NET Core.
2. [Why Share Data Between Components?](https://www.ask-codey.com/lessons/angular-services-why-share-data-between-components) (Journeyman): Inputs and outputs only connect parents and children. When components far apart need the same data, such as a cart shown in the header and filled from a product page, passing it through every component in between gets messy. A shared service holds it in one place instead.
3. [Creating a Shared Data Service](https://www.ask-codey.com/lessons/angular-services-creating-a-shared-data-service) (Journeyman): A shared data service keeps its state in a private signal, shows it to components read-only with asReadonly() and computed values, and changes it only through its own methods. Every component that injects it sees the same, up-to-date data.

## [Calling APIs from Angular](https://www.ask-codey.com/courses/csharp-full-stack-bootcamp/topics/calling-apis-from-angular)

1. [HttpClient in Angular](https://www.ask-codey.com/lessons/calling-apis-from-angular-httpclient-in-angular) (Journeyman): Call your Web API from a service with HttpClient's get, post, put and delete, each typed with the model it returns. Angular provides HttpClient on its own. While developing, a proxy sends the app's /api requests on to the API, so the browser sees one origin.
2. [Observables and RxJS Basics](https://www.ask-codey.com/lessons/calling-apis-from-angular-observables-and-rxjs-basics) (Journeyman): An observable is a stream of values that arrive over time. Nothing happens until you subscribe, with handlers for the values, an error and the end. HttpClient's observables send one value, the response, then complete. RxJS operators in pipe, such as map, transform the values.
3. [Signals and Observables Together](https://www.ask-codey.com/lessons/calling-apis-from-angular-signals-and-observables-together) (Journeyman): toSignal turns an observable into a signal, subscribing straight away and unsubscribing when the component goes, so a template reads API data like any signal. For loading and error states, subscribe and set signals for the data, the loading flag and the message.

## [Exercise: an Angular Client for a Web API](https://www.ask-codey.com/courses/csharp-full-stack-bootcamp/topics/exercise-an-angular-client-for-a-web-api)

1. [Exercise: an Angular Client for a Web API](https://www.ask-codey.com/lessons/exercise-an-angular-client-for-a-web-api) (Journeyman): Give your products API a front end. A service calls the API with HttpClient; a component lists the products, filters them by category, deletes them and adds new ones, and says so when something fails. Ten tests answer for a pretend API, so they need nothing running.

Source: https://www.ask-codey.com/courses/csharp-full-stack-bootcamp/chapters/services-http-and-observables
