I'm using angular-phonegap-seed to write a mobile app, and was wondering if there were any known issues with using $http.
My controller code is called on the push of a button.
$http.get('http://192.168.1.2:8000/request_token').success(function(data, status, headers, config){
$scope.token = 'sucess: ' + data + ' ' + status + ' ' + headers + ' ' + JSON.stringify(config);
}).error(function(data, status, headers, config){
$scope.token = 'error: ' + data + ' ' + status + ' ' + headers + ' ' + JSON.stringify(config);
});
At the moment, request_token
on the server is simply a file with a dummy token in it.
The server acknowledges getting the request in the console and responds with 200. The phonegap app on android however responds:
error: undefined undefined undefined {"transformrequest": [NULL], "transformresponse": [NULL], "method": "GET", "url": "http://server-ip:8000/request_token", "headers": {"accept": "application/json, text/plain, */*"}}
Can I use the regular $http.get() method in phonegap, or do I have to use a phonegap api?
In my case, it turns out to be that I forgot about whitelisting the domains I was sending request to.
Check out the Domain Whitelist Guide and see if it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With