'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),
};
}
]);
答案 0 :(得分:0)
如果你的意思是里面的路径是什么
$http.get('/students')
这是一个相对路径,根据运行应用程序的服务器名称,它被翻译为
https://yourdomain.com/students
(如果您在https://yourdomain.com
上运行应用程序)
在后端(API)上,路线将被翻译以获得所需的结果