Ionic http fetch remote server

I’m trying to consume a web service from my Ionic App using Angular Http. I’m following Josh Morony Example -> but I´m receiving the following error when I use an IP address in the url :

ERROR Object { _body: error, status: 0, ok: false, statusText: "", headers: Object, type: 3, 
url: null }

Here is my ts code -> home.ts

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { Injectable } from '@angular/core';
import { Headers, Http, Response } from '@angular/http';
import 'rxjs/add/operator/map';

  selector: 'page-home',
  templateUrl: 'home.html'
export class HomePage {
  posts: any;
  url: string = '';

  constructor(public navCtrl: NavController, public http: Http) {

    this.http.get(this.url).map(res => res.json()).subscribe(data => {
      this.posts =;




The problem is when I use IP address, if I use the url of the example: works fine.
Any ideas or comments. Thank you in advance!

Perhaps the firewall on your server blocks the port 9090.

You should try to avoid hardcoded ips inside your app let the dns resolve it

How are you testing?
What is your ionic info?

Note that the IP is also using http, the proper API is using https.

Sorry there was an error in the server, now is running OK. I mean the web service is running OK, but I still have the problem, Angular 2 or Ionic 2 does not understand the URL as an IP Address. I also made some test with CURL - PHP and it works fine. Hope somebody can give me some tips !

Finally I found that the problem was with the CORS. The solution, I configure a proxy on ionic.config.json file, and now Http can work with Ip address.