title: PhoneGap - Angularjs http service (PHP API call) Not Working
body: <p>I try to use <strong>Angularjs http service</strong> to call my PHP API. Everything working fine in Browser. But, when I test it on my Android Phone, it will not work.</p>
  
  <p><strong>My Issue:</strong></p>
  
  <p>In Android PhoneGap Application, Whenever I trigger the <strong>Angularjs http service</strong> it will always trigger the <code>function (error)</code> even when the Mobile is connected with Internet.</p>
  
  <p>I have try look this but their solution aren't working: </p>
  
  <ol>
  <li><a href="https://stackoverflow.com/questions/34634992/angular-http-get-does-not-work-in-phonegap-devapp">Angular $http.get() does not work in Phonegap DevApp</a></li>
  <li><a href="https://stackoverflow.com/questions/32605034/cordova-5-3-1-android-app-cant-access-the-internet">Cordova 5.3.1 Android app can&#39;t access the internet</a></li>
  </ol>
  
  <p>I also have ensure the Phonegap <code>config.xml</code> has allowed Internet Permission Access with:</p>
  
  <pre><code>&lt;access allows-arbitrary-loads-in-media="true" allows-arbitrary-loads-in-web-content="true" allows-local-networking="true" origin="*" /&gt;
  &lt;allow-intent href="*" /&gt;
  &lt;allow-navigation href="*" /&gt;
  </code></pre>
  
  <p>However it is still not Working.</p>
  
  <p><strong>My Question:</strong></p>
  
  <ol>
  <li>Is Angularjs http service is not able to work on PhoneGap Mobile Application but only Web Browser? </li>
  <li>Aside from <code>config.xml</code> , is there any other configuration have to be made to allow PhoneGap Mobile Application to access the Internet?</li>
  </ol>
  
  <p><strong>Angularjs code:</strong></p>
  
  <pre><code>$http.defaults.headers.post['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
  
  $http({
      method: 'POST',
      data: {
          'email' : $scope.email,
          'password' : $scope.password,
      },
      url: 'https://unsurfaced-cross.000webhostapp.com/PGLogin.php'
   }).then(function (response){
      $scope.users = response.data;
  
      if(response.data[0]=="LOGIN"){
        alert("Successful Login");
        $window.location.href = './homepage.html';
  
      }else{
        alert("Login Failed. Incorrect Email or Password.");
      }
  
   },function (error){
        alert("Please ensure You are connected to Internet.");
   });
  </code></pre>