I have a service that is responsible for loading data.
angular.module('App').service('daysService', ['$http','$q',function($http,$q) {
var days = [];
return {
loadDay: function() {
$http({
method: 'get',
url: '/app/days/list/',
}).success(function(data) {
days.push(data);
return days;
}).error(function (data) {
console.log('Error while checking server.');
});
}
};
}]);
In the controller, I am calling this service like so:
daysService.loadDay.then(function(data) {
alert(data)
});
However, I am encountering the following error:
TypeError: daysService.loadDay.then is not a function
Do you have any suggestions on how to resolve this issue?