This is an old angular code, I'm getting error with the Http, Headers, RequestOptions.
can someone help me fix this and get same function. Thanks in advance.
i used "import { HttpClient, HttpHeaders, HttpRequest } from '@angular/common/http';"
but some function are still not working properly here "let options = new HttpRequest({ headers: headers });"
import { Injectable } from '@angular/core';
import { Http, Headers, RequestOptions } from '@angular/http';
import 'rxjs/add/operator/map';
@Injectable()
export class PostProvider {
server: string = "http://localhost/server_api/"; // default
constructor(public http : Http) {
}
postData(body, file){
let type = "application/json; charset=UTF-8";
let headers = new Headers({ 'Content-Type': type });
let options = new RequestOptions({ headers: headers });
return this.http.post(this.server + file, JSON.stringify(body), options)
.map(res => res.json());
}
}