in ionic 2 …call web api using post method that time facing this error when I wrote { headers:headers }
this is my code
error : Argument of type ‘{headers:Headers;}’ is not assignable to parameter of type ‘RequestOptionsArgs’.Property ‘null’ is missing in type ‘{headers:Headers;}’
var headers = new Headers();
headers.append('Content-Type', 'application/x-www-form-urlencoded');
//let options = new RequestOptions({ headers: headers });
let postParams = {
type: 'insertbranch',
vendorid: 1,
imgcode: ' ',
address: 'varachhaSurat',
latitude: '0',
longitude: '0',
branchmobile: '9853624221',
gstno: '0'
}
this.http.post("MY URL", postParams, { headers: headers })
.subscribe(data => {
console.log(data['_body']);
}, error => {
console.log(error);// Error getting the data
});