Does $ http work in a phone call?

I am using angular -phonegap-seed to record a mobile application and wonder if there were any known issues using $ http.

My controller code is invoked by the click 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 just a dummy token file.

The server confirms the receipt of the request in the console and answers 200. However, the phonegap application on the android 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 a telephone call, or do I need to use the handset api?

+4
source share
1 answer

In my case, it turned out that I forgot about how to remove the domains to which I sent the request.

Browse the Domain Whitelist List and see if it helps.

+7
source

Source: https://habr.com/ru/post/1491629/


All Articles