-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.service.js
31 lines (27 loc) · 996 Bytes
/
main.service.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
angular
.module('Main')
.factory('MainService', ['$q', '$http',
function MainService($q, $http) {
function getAbout() {
var deferred = $q.defer();
$http.get('/about').then(function (response) {
deferred.resolve(response);
}, function (error) {
deferred.reject(error);
});
return deferred.promise;
}
function sendFeedback(data) {
var deferred = $q.defer();
$http.post('/feedback', data).then(function (response) {
deferred.resolve(response);
}, function (error) {
deferred.reject(error);
});
return deferred.promise;
}
return {
getAbout: getAbout,
sendFeedback: sendFeedback
}
}]);