student.service.js
'use strict';
angular.module('StudentApp').factory('StudentService', ['$http',
function($http) {
return {
get: () => $http.get('/students').then(response => response.data),
add: student => $http.post('/students', student).then(response => response.data),
delete: id => $http.delete('/students/' + id).then(response => response.data),
//getById: id => $http.get('/students/' + id).then(response => response.data),
update: (id, student) => $http.put('/students/' + id, student).then(response => response.data),
};
}
]);