webentwicklung-frage-antwort-db.com.de

winklig 6 oder 7: Importieren von RequestOptions und ResponseContentType in '@ winklig/common/http'

Ich habe Code für Winkel 4 nach Winkel 6 migriert. Importieren von Code für Winkel 6 oder 7 {RequestOptions, ResponseContentType} von '@ angle/common/http';

1
Amol B Lande

Pass diesen Weg ...

import { HttpClient, HttpHeaders } from '@angular/common/http';

 let headers = new HttpHeaders({
    'Content-Type': 'application/json'
 });
 let options = {
    headers: headers
 }

 this.http.post(URL, param, options)
    .subscribe(data => {
         console.log(data);
 });



 // For pass blob in API 

 return this.http.get(url, { headers: new HttpHeaders({
   'Authorization': '{data}',
   'Content-Type': 'application/json',
 }), responseType: 'blob'}).pipe (
 tap (
     // Log the result or error
     data => console.log('You received data'),
     error => console.log(error)
  )
);
4
Sachin Shah