AngularJS Service returns undefined
I have the following service: 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; }); } }; }]; In my controller I am assigning the return value to a $scope.message var so that I can display in the front end. $scope.message is undefined $scope.getMessage =