angular 6 или 7: как импортировать RequestOptions и ResponseContentType в «@ angular / common / http» - PullRequest
0 голосов
/ 02 ноября 2018

Я переместил угловой код 4 в угловой 6, и я хочу знать, как импортировать приведенный ниже код в угловой 6 или 7?

import { RequestOptions, ResponseContentType } from '@angular/common/http';

1 Ответ

0 голосов
/ 02 ноября 2018

Пройдите этот путь ...

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)
  )
);
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...