title: $q.defer() not working with Angular service
body: <p>I'm new to angular's $q and I'm trying to build a service that makes an API call and returns it back to the controller. </p>
  
  <p>Problem: No matter how I seem to format it, the service <code>returns</code> right before it gets to $http.get(...)</p>
  
  <p>Service:</p>
  
  <pre><code>   // methods: query new, get existing
    makeRequest: function(url, following) {
        // create promise
        var deferred = $q.defer();
  
        $http.get(url, {
            params: {
                "following": JSON.stringify(following)
            }
        })
            .then(function(res) {
  
                console.log(res);
                deferred.resolve(res.data);
            });
  
        return deferred.promise;
    },
  
    getFeed: function(user) {
        console.log('&gt;&gt; userService[getUser]: retrieving user...');
  
  
        if (!this.activities) {
            // Request has not been made, setting user profile. 
            console.log('&gt;&gt; userService[getUser]: No user stored, making request...');
            var following = this.compileArray(user);
            console.log(following);
            this.activities = this.makeRequest('api/network/activities', following);
        };
  
        // Return the myObject stored on the service
        return this.activities;
    }
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>$scope.recentActivity = activityService.getFeed(profile);
  
  // also tried
  activityService.getFeed(profile).then(function (res) {
                    $scope.recentActivity = res;
                    console.log(res);
                  }); 
  </code></pre>
  
  <p><strong>EDIT</strong> : 9:40am 05/06/2015</p>
  
  <p>If possible, I'd like to retrieve the activity list in the controller from the service in the same way I would if it were new (using <code>.then</code>). Is that possible/ bad practice?</p>
  
  <pre><code>  getFeed: function(user) {
      if (!this.activities) { 
        ...
      } else {
        feedPromise = $q(function(resolve){ resolve(this.activities) });
        console.log(feedPromise);
        // returns: {$$state: Object, then: function, catch: function, finally: function}
  
        feedPromise.then(function(res) {
          console.log(res);
          // returns: undefined
        });
  
        console.log(that.activities);
        // Works, returns list of activities. 
  
     }
  </code></pre>