HTTP
The categories are currently hardcoded values; however, they should be loaded from the RESTful API and through HTTP calls. Angular provides its own abstraction for HTTP, in the form of a service that you can use when necessary.
Next, let's use Angular's HttpClient
 service to load the categories from the backend RESTful API:
- Import
HttpClientModule
 intoÂapp.module.ts
 to make theÂHttpClient
 service available to the entire app:
… import { HttpClientModule } from '@angular/common/http'; … @NgModule({ … imports: [ HttpClientModule, … ], … })
- Use theÂ
HttpClient
 service inCategoriesService
 as follows. If the HTTP address differs in your setup, then make sure to change it accordingly:
import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { CoreModule } from '../core.module'; import { Category } from '../../../model'; @Injectable({ providedIn: CoreModule, }) export class CategoriesService { constructor(private readonly http: HttpClient...