Hi in ionic v-3 when dont have internet connection cant catch error , this is the code i use:
this.headers = new Headers({ ‘Content-Type’: ‘application/x-www-form-urlencoded’,
‘Accept’: ‘q=0.8;application/json;q=0.9’ });
this.options = new RequestOptions({ headers: this.headers });
let creds = JSON.stringify({ xxxxx:"yyyyy", xxyyxyyx: "jjjjjjj"});
let data = new URLSearchParams();
data.append('datajson', encodeURIComponent(creds));
var body = data.toString();
this.http.post('https://www.sitioprueba.com/ServicioWeb/general.asmx/xxx', body, {
headers: this.headers
}).subscribe(
data => {
this.showToast1();
this.datoscompletos= data.json();
},
err => {
this.logError(err.json().message)
},
() => {
}
);