I am getting warning in console like below. And this warning coming from zone.js
Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user's experience. For more help, check https://xhr.spec.whatwg.org/.
I was using Angular 2 and now I updated to Angular 4. I am also using kendo UI Angular controls. I want to know is this because of angular version update or because of my service implementation. below is service code snippet.
post(url: any, data: any) {
let headers = new Headers({ 'Content-Type': 'application/json' });
let options = new RequestOptions({ headers: headers });
try {
return this.http.post((new RequestOptions({ headers: headers }))).do(data => {
if (data != null && data.statusText != "No Content") {
console.log("Response Data - ", data.json());
}
});
}
catch (e) {
console.log(e);
return null;
}
}
I know this is caused by trying to do a synchronous AJAX call from the browser. but don't know how to fix it in angular 4.