Hi,
I created a web application in angular2.There  are some apis are called 
using http.post method. There is a login button in home page, when I click 
on it , it calls the service , but error is shown. It works perfectly in 
desktop browsers. Error is only with mobile devices.
Error occurred related to zonejs.The error is shown below.


"zone.js:2019 GET http://192.168.1.14:4500/sockjs-node/info?t=1507186888172 
net::ERR_CONNECTION_TIMED_OUT"
"zone.js:2019 XHR failed loading: GET 
"http://192.168.1.14:4500/sockjs-node/info?t=1507186888172";.
"zone.js:2019 GET http://192.168.1.14:4500/sockjs-node/info?t=1507186921177 
net::ERR_CONNECTION_TIMED_OUT"
"zone.js:2019 XHR failed loading: GET 
"http://192.168.1.14:4500/sockjs-node/info?t=1507186921177";
"zone.js:2019 OPTIONS http://192.168.1.14/cvplus_api/public/api/login 
net::ERR_CONNECTION_TIMED_OUT"
"zone.js:2019 XHR failed loading: POST 
"http://192.168.1.14/cvplus_api/public/api/login";

The code is given below,

public logIn(param){
return 
this.http.post(Appsettings.API_URL+'login',param,{headers:this.getHeaders()})
.map( (response) => {
var string = response.text();
var parseString = JSON.parse(string);
return parseString
})
.catch((error: any) => { console.log('inside ERRRRR......') ; 
console.log(error) ;return Observable.throw(error.statusText);});
}
private getHeaders(){
let headers = new Headers();
headers.append("Access-Control-Allow-Origin", "*");
headers.append("Access-Control-Allow-Credentials", "true");
headers.append("Access-Control-Allow-Methods", "GET,HEAD,OPTIONS,POST,PUT");
headers.append('Content-Type', 'application/x-www-form-urlencoded'); 
headers.append("Access-Control-Allow-Headers", "*");
return headers;
}



-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to