Slide 12
Slide 12 text
Create Service
ng generate service constructor(private http: HttpClient) {
}
Inject http service
apiurl = 'api/Users’;
headers = new HttpHeaders().set('Content-Type',
'application/json').set('Accept',
'application/json');
httpOptions = {
headers: this.headers
};
Use the data Import required
statements
import { HttpClient, HttpHeaders, HttpParams }
from '@angular/common/http';
import { Observable, throwError } from 'rxjs';
import { tap, catchError, map } from
'rxjs/operators';
import { User } from './User';