We are building an angular app which is having multiple functions based on GET, POST and PUT methods. For Example
this.updateEmp = function (employee) {
var response = $http({
method: "post",
url: "Home/UpdateEmployee",
data: JSON.stringify(employee),
dataType: "json"
});
return response;
}
this.AddEmp = function (employee) {
var response = $http({
method: "post",
url: "Home/AddEmployee",
data: JSON.stringify(employee),
dataType: "json"
});
return response;
}
My question is, is there any way to make this function common in common controller and only URL passing is enough in service.?
You may create a simple service as follow and use on desired location
for example