894b21fa
Geoffrey PREUD'HOMME
Application MEAN ...
|
1
2
3
4
5
6
7
8
9
|
// public/js/services/NerdService.js
angular.module('NerdService', []).factory('Nerd', ['$http',
function ($http) {
return {
// call to get all nerds
get: function () {
return $http.get('/api/nerds');
},
|
894b21fa
Geoffrey PREUD'HOMME
Application MEAN ...
|
10
11
12
13
14
15
16
17
18
19
20
21
22
|
// call to POST and create a new nerd
create: function (nerdData) {
return $http.post('/api/nerds', nerdData);
},
// call to DELETE a nerd
delete: function (id) {
return $http.delete('/api/nerds/' + id);
}
}
}
]);
|