...

/

Creating Services for Client Contacts Manager Application

Creating Services for Client Contacts Manager Application

Let's create a service that contains In-Memory Web API to provide a to mak mock REST API calls to local memory and make use of services in order to save and manage data within the application.

Major changes

In this version of the application, we have made the following changes:

  • Added Services, one for the Client section and one for the Company section.

  • Added forms for Adding, Editing, and Deleting both Clients and Companies.

  • Used angular-in-memory-web-api to store data locally.

  • Added lazy loading of routes.

app/services

This contains a service, in-memory-data.service.ts, which uses a third-party library to provide make mock REST API calls to local memory. This allows the user to build a REST API to write data without having to use a hosting service. This service will be used by both the Client and Company Services.

import { Injectable } from '@angular/core';
import { InMemoryDbService } from 'angular-in-memory-web-api';
import { Client } from '../clients/client';

@Injectable({
  providedIn: 'root'
})
export class InMemoryDataService implements InMemoryDbService {
 
...