title: How to send GET request to Web-Api using Angularjs and PhoneGap?
body: <p>I am new in Angularjs and PhoneGap. I am trying to send a get request to my Web-Api 2 project using Angularjs and PhoneGap but i getting an error. It is working in each browser.</p>
  
  <p>My Code is :</p>
  
  <pre><code>taxiConceptControllers.controller('loginCtrl', ['$scope', '$routeParams', 'loginService', '$http',
   function ($scope, $routeParams, loginService, $http) {
    $scope.loginProvider = loginService.url;
    $scope.intLoginProvider = function () {
        console.log("call");
        $http({
            headers: {
                'Content-Type': 'application/x-www-form-urlencoded'
            },
            method: "GET",
            url: 'http://localhost:15229/api/values',
        }).success(function (userData) {
            console.log(userData);
        }).error(function (data, status, headers, config) {
            console.log('error');
        });
    };
  }]);
  </code></pre>
  
  <p>Error :</p>
  
  <p><img src="https://i.stack.imgur.com/idd2m.png" alt="enter image description here"></p>
  
  <p>My web-Api 2 support Cross.</p>
  
  <p>it will return JSON format result and it will be <code>["value1","value2"]</code> but i get an error.</p>
  
  <p>I am using :</p>
  
  <ul>
  <li>Visual Studio 2013 ultimate with windows Phone 8 SDK</li>
  <li>Angularjs 1.2.14</li>
  <li>PhoneGap 2.9.1</li>
  </ul>
  
  <p><strong>Update 1 :</strong></p>
  
  <p>I put those lines :</p>
  
  <pre><code>     console.log(status);
       console.log(headers);
       console.log(config);  
  </code></pre>
  
  <p>Output is :</p>
  
  <pre><code>     404
        function(c){a||(a=nc(b));return c?a[O(c)]||null:a}
  [object Object]
  </code></pre>
  
  <p><strong>Update 2 :</strong> <img src="https://i.stack.imgur.com/Rkwb8.png" alt="enter image description here"></p>
  
  <p>More about my error.</p>
  
  <p><strong>Update 3 :</strong></p>
  
  <p>my Index.html :</p>
  
  <pre><code>    &lt;!DOCTYPE html&gt;
      &lt;html lang="en" ng-app="taxiConceptApp"&gt;
      &lt;head&gt;
          &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt;
          &lt;meta name="format-detection" content="telephone=no" /&gt;
          &lt;meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" /&gt;
          &lt;link rel="stylesheet" type="text/css" href="css/index.css" /&gt;
          &lt;link href="css/bootstrap.min.css" type="text/css" rel="stylesheet" /&gt;
          &lt;link href="css/bootstrap-theme.min.css" type="text/css" rel="stylesheet" /&gt;
          &lt;link href="css/app.css" rel="stylesheet" /&gt;
          &lt;title&gt;Hello World&lt;/title&gt;
  
  
      &lt;/head&gt;
      &lt;body&gt;
  
      &lt;div id="contnr" ng-view&gt;
      &lt;/div&gt;
  
      &lt;script type="text/javascript" src="cordova.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/index.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
          app.initialize();
      &lt;/script&gt;
  
      &lt;script type="text/javascript" src="js/jquery-2.1.0.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/bootstrap.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript" src="js/angular.min.js"&gt;&lt;/script&gt;
      &lt;script src="js/angular-route.js"&gt;&lt;/script&gt;
  
  
  
      &lt;script src="js/app.js"&gt;&lt;/script&gt;
  
      &lt;script src="js/service/appservice.js"&gt;&lt;/script&gt;
      &lt;script src="js/service/loginservice.js"&gt;&lt;/script&gt;
  
      &lt;script src="js/controllers/loginctrl.js"&gt;&lt;/script&gt;
  &lt;/body&gt;
  
  &lt;/html&gt;
  </code></pre>
  
  <p>My App.js is :</p>
  
  <pre><code>var taxiConceptControllers = angular.module('taxiConceptControllers', []);
  
  var taxiConceptApp = angular.module('taxiConceptApp', [
    'ngRoute',
    'taxiConceptControllers'
  ]);
  
  var onDeviceReady = function() {
      angular.bootstrap(document, ['taxiConceptApp']);
  };
  document.addEventListener('deviceready',
  onDeviceReady);
  
  taxiConceptApp.config(['$routeProvider',
    function ($routeProvider) {
        $routeProvider.
          when('/Login', {
              templateUrl: 'Templates/login.html',
              controller: 'loginCtrl'
          }).
          when('/phones/:phoneId', {
              templateUrl: 'partials/phone-detail.html',
              controller: 'PhoneDetailCtrl'
          }).
          otherwise({
              redirectTo: '/Login'
          });
    }]);
  </code></pre>
  
  <p>Login.Html is :</p>
  
  <pre><code>&lt;div ng-controller="loginCtrl" ng-init="intLoginProvider()"&gt;
      &lt;h1&gt;asdasads&lt;/h1&gt;
      {{loginProvider}}
  &lt;/div&gt;
  </code></pre>
  
  <p>My solution Explorer is:</p>
  
  <p><img src="https://i.stack.imgur.com/ABM3S.png" alt="enter image description here"></p>
  
  <p>I use PhoneGap 2.9.1 and build it for windows phone 8</p>