error Response with status: 0 for URL: null


let link = ‘’;
let data = JSON.stringify({username: “test”});, data)
    .subscribe(data => {
    console.log("ok ");
    }, error => {
        console.log("error : "+error);


I’m having this same problem, only on android… just wasted hours looking for a solution for something that should work out the box. Works just fine on serve


Are you sure your server is getting the request and returning the proper data?


yes, it works just fine with ionic serve, doesn’t work on device


Okay, that makes sense since you’re requesting which is localhost which is only going to work on the server machine. Get the local IP of your server and use that instead (on mac you can do ifconfig). It’ll be something like 192.168.* or 10.0.1.* most likely (could be something else depending on your network). Then make sure your device is on wifi.