Implementing the course service

To implement the course service for the REST API, we’ll implement the logic in the frontend of our Angular application by following the steps below:

Step 1: Generating a new service

To implement the REST API in our Angular application, we need to start by creating a services file for the course service. We can do this by running the command below:

ng g s services/course

The above code will generate a boilerplate service for us by default.

Step 2: Course service injection

This step involves injecting the newly created course service and the HttpClientModule into our application’s app.module.ts file.

Get hands-on with 1200+ tech skills courses.