(function () { "use strict"; angular.module('shared') .factory('photoUploadService', ['$http', function ($http) { var uploadProfilePic = function(profilePic){ var data = new FormData(); data.append('file', profilePic); return $http.post('/api/photo-upload', data, { transformRequest: angular.identity, headers: {'Content-Type': undefined} }).then(function(response){ return response.data; }); }; return { uploadProfilePic: uploadProfilePic }; }]); })();