AIA.factory('ImageService', function ($http, $q) { return { sendImageDataArray: function (maskImageData) { var deferred = $q.defer(); $http.post('/AIA.POC.WebAPI/api/ImagProcess', JSON.stringify(maskImageData), { // $http.post('/AIA.POC.WebAPI/api/ImagProcess', ("ImageData"), { headers: { 'Content-Type': 'application/json' } }) .success(function (data, status, headers, config) { console.log('success') deferred.resolve(data); }).error(function (data, status, headers, config) { debugger; console.log('error') deferred.reject(status); }); return deferred.promise; } } });