July 2018
Intermediate to advanced
420 pages
8h 46m
English
Now, we are going to create the service to hold all bike operations. Remember, for both bikes and builders, our service must have methods for listing, details, creation, updating, and deletion:
ng g service pages/bikes/_services/bike
The previous command will create a new folder and file in ./app/pages/bikes/_services/bike.service.ts. Now, let's add some pieces of code.
Open ./app/pages/bikes/_services/bike.service.ts and add the following imports to the top of the file:
import { Injectable } from '@angular/core'; import { HttpClient, HttpParams, HttpErrorResponse } from '@angular/common/http'; import { HttpHeaders } from '@angular/common/http'; import ...Read now
Unlock full access