title: AngularJS Service returns undefined
body: <p>I have the following service: </p>
  
  <pre><code>app.services.emailService = ['$http', '$sce', function ($http, $sce) {
  
      return {
          getMessage: function(messageId, callback) {
              $http.get('/api/email/inbox' + '/' + messageId).then(function(response) {
                  response.data.message.updated_at = new Date(response.data.message.updated_at.replace(/-/g,"/"));
                  response.data.message.body = $sce.trustAsHtml(response.data.message.body);
                  return response.data;
              });
          }
      };
  
  }];
  </code></pre>
  
  <p>In my controller I am assigning the return value to a <code>$scope.message</code> var so that I can display in the front end. </p>
  
  <p><code>$scope.message</code> is undefined</p>
  
  <pre><code>$scope.getMessage = function(messageId) {
          $scope.message = emailService.getMessage($scope.messages[messageId].id);
          console.log($scope.message);
      }
  </code></pre>