My view is not getting reflected after the update/Delete/Create
My List page is EmpList. My update page is EmpDetail.
Here is my controller
$scope.UpdateEmp = function () {
var empl=$scope.Employee;
empFactory.empUpdate.update({ EmpID: $routeParams.EmpID, empval: empl });
$location.path('/EmpList');
};
Here is my Service
var resource = {
empUpdate:
$resource('../../Employee/PutEmployee/:EmpID', { EmpID: '@EmpID', empval: '@empl' }, { update: { method: 'PUT', isArray: true } })
}
return resource;
Here is my MVC controller
[HttpPut]
public JsonResult PutEmployee(int id, Employee empval)
{
empval.EmpID = id;
int index = emp.GetEmployees().FindIndex(i => i.EmpID == empval.EmpID);
emp.GetEmployees().RemoveAt(index);
emp.GetEmployees().Add(empval);
return Json(emp.GetEmployees(), JsonRequestBehavior.AllowGet);
}
MVC controller is getting called and the data is getting updated correctly, but it's not getting reflected in the main page
Note: In Emplist.html, I have the controller mapped where I m doing the query part to reflect the changes. The URL is not redirected to EmpList at all.
$scope.Employees = empFactories.query(function () {
console.log($scope.Employees);
});
You're sending the data but not using the reply:
Now you can assign the reply to your
$scope