AIA.factory('TermService', function ($http, $q) { return { getTermData: function (layerNo, BodyViewId, systemNo, zoomLevel) { var deferred = $q.defer(); //var URL = 'http://localhost:86/api/PixelLocations?layerNumber=' + layerNo + '&bodyViewIndex=' + BodyViewId + '&systemNumber=' + systemNo + '&zoomLevel=' + zoomLevel + '' var URL = '/API/api/PixelLocations?layerNumber=' + layerNo + '&bodyViewIndex=' + BodyViewId + '&systemNumber=' + systemNo + '&zoomLevel=' + zoomLevel + '' $http({ method: 'get', url: URL, headers: { 'Content-Type': 'application/json', } }) .success(function (data, status, headers, config) { console.log('success') deferred.resolve(data); }).error(function (data, status, headers, config) { console.log('error status= ' + status) deferred.reject(data); }); return deferred.promise; }, } })