hi,
i want to update and delete the record from angular array object. i don't know how to do this. i am totally new to work with angular please help.
my code is below:
$scope.AddEmployee = function () {
$scope.Employee = {};
$scope.Employee.EmpName = $scope.EmpName;
$scope.Employee.Address = $scope.Address;
$http({
method: 'post',
url: 'Employee/AddEmployee',
dataType: 'json',
data: JSON.stringify($scope.Employee)
}).then(function (response) {
$scope.Employees.push({
EmpName: response.data.EmpName,
Address: response.data.Address,
EmpId: response.data.EmpId
});
$scope.EmpName = "";
$scope.Address = "";
}, function () {
alert('Error! try again');
});
}
What I have tried:
$scope.AddEmployee = function () {
$scope.Employee = {};
$scope.Employee.EmpName = $scope.EmpName;
$scope.Employee.Address = $scope.Address;
$http({
method: 'post',
url: 'Employee/AddEmployee',
dataType: 'json',
data: JSON.stringify($scope.Employee)
}).then(function (response) {
$scope.Employees.push({
EmpName: response.data.EmpName,
Address: response.data.Address,
EmpId: response.data.EmpId
});
$scope.EmpName = "";
$scope.Address = "";
}, function () {
alert('Error! try again');
});
}
i want to do this kind of functionality while edit the record, update only particular row not the complete data.