title: Angular $http set cookie on each request after login
body: <p>I'm having troubles with $http calls in AngularJS. I've created the following services </p>
  
  <pre><code>    crApp.service('authService', function ($http) {
  
      var urlBase = 'http://192.168.xx.xx:8081';
  
      // POST api/login/
      this.login = function (credentials) {
      return $http.post(urlBase + "/api/login", credentials);
      };
  
    // POST api/logout/
    this.logout = function () {
      return $http.post(urlBase + "/api/logout/", "");
    };
  
  }); //end service
  
  crApp.service('dataService', function ($http) {
  
    var urlBase = 'http://192.168.xx.xx:8081';
  
    // POST api/query/
    this.pull = function (query) {
      return $http.post(urlBase + "/api/query", query);
    };
  </code></pre>
  
  <p>From the controller I call the login method:</p>
  
  <pre><code>$scope.login = function(){
      authService.login(credentials)
          .success(function(data) {
              console.log("RESULT LOGIN: " + data );
          })
          .error(function(data, status, headers, config) {
              console.log(data);
              console.log(status);
              console.log(headers);
              console.log(config);
          });
  };
  </code></pre>
  
  <p>So far so good and I receive a response where a cookie is set: 
  <img src="https://i.stack.imgur.com/07Ux3.png" alt="enter image description here"></p>
  
  <p>After succesfull login I call the following method:</p>
  
  <pre><code>var locations = { query: "from location select uid, name, description, address, phone", dataFormat: "verbose" };
  $scope.getLocations = function() {
      dataService.pull(portals)
          .success(function (data) {
              console.log("RESULT QUERY: " + data)
          })
          .error(function(data, status, headers, config) {
              console.log("Query niet gelukt!");
              console.log(data);
              console.log(status);
              console.log(headers);
              console.log(config);
          });
  };
  </code></pre>
  
  <p>Result:</p>
  
  <p><img src="https://i.stack.imgur.com/L7uim.png" alt="enter image description here"></p>
  
  <p>So cookie is not set in the headers.
  I'm using AngularJS 1.3.15 and calls are made to a remote server on a different domain, but it does work in the REST Client tool in WebStorm (Jetbrains). So it must be something i'm missing in Angular!?? </p>
  
  <p>Hopefully someone can help me out.</p>