Ionic $http return status 0


#1

Hi all,

i’m starting from ionic start myApp sidemenu project.
I added a simple button

<button ng-click="fun()" class="button button-block button-stable">Test</button>

this is my function on my controller:

$scope.fun = function() {
		var url = "http://brincalatablita.com/api/products/all/format/json"
		alert(url);
		$http.get(url).success(function(data) {alert(data);}).error(function(data,status){alert(data+status);});
	}

Now if i run on browser with ionic serve it works, if i run on ionic view it works, but if i run with ionic run android it return status 0.

Pleaase, any idea?


#2

do you have this line in config.xml?

<access origin="*"/>

#3

Hi @dany85,
Install this plugin

ionic plugin add cordova-plugin-whitelist 

you can see doc at https://github.com/apache/cordova-plugin-whitelist


#4

yes thanks it works!