Mocking services using stubs
There's rarely an Angular app that doesn't have a Service
created inside it. And where the overall business logic is concerned, services hold a great deal of the business logic, particularly when it comes to interacting with APIs. In this recipe, you'll learn how to mock services using stubs.
Getting ready
The project for this recipe resides in chapter10/start_here/mocking-services-using-stubs
. Perform the following steps:
- Open the project in Visual Studio Code.
- Open the Terminal and run
npm install
to install the dependencies of the project. - Once done, run
ng serve -o
.
This should open the app in a new browser tab. You should see something like the following screenshot:
Now that we have the app running locally, in the next section, let's take a look at the steps of the recipe.