Cellular Ionic http request framework

Asked

Viewed 213 times

1

I have an Ionic page that makes request for a page in codeigniter, I send the data and receive correctly, no problems in the browser, but when I turn into . apk and I run the application on the phone until it runs but any button you have makes an http request does not work, someone knows why?

  • Post how you implemented these calls in a minimal scenario to facilitate analysis and possibly a response.

  • My code in angular js: $http.get("http://localhost/index.php/Homecontroller/listing"). Success(Function(data,status){ $Scope.listing = data; }). error(Function(data,status){ console.log("error"); I receive this data and step to an ng-controller, but when running on the web browser I tried to fix the settings in the app.js to accept : $httpProvider.defaults.headers.common = {}; $httpProvider.defaults.headers.post = {}; $httpProvider.defaults.headers.put = {}; $httpProvider.defaults.headers.patch = {};

1 answer

1

Oops, I’m starting to, too, but I think I can shed some light When you put your application on mobile, you are no longer sending your request to localhost. you need to connect your phone and your computer to the webservice on the same network, and put in the request, where it has the localhost name, the ip of your computer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.