I am new in angularJs.. I have One Query How to refresh data in ng-Repeat
My View Look Like This :

Now, I Press the Delete Button Event then the Record Not Remove From Grid ...

$scope.Deletepovider = function (ProviderListId) {
if (confirm('Are you sure you want to delete this?')) {
var getmsg = AdminService.DeleteProviderDetail(ProviderListId, '/Admin/Delete', $scope.onDeleteCompleted, $scope.onDeleteError);
return true;
} else {
e.stopImmediatePropagation();
e.preventDefault();
return false;
}
}
$scope.onDeleteCompleted = function (response, status) {}
$scope.onDeleteError = function (response, status) {}
I would say, in general, you don't want to "refresh" your list after performing an operation like this. Rather, you want to manage the list it's bound to. Consider something like this:
$scope.Deletepovider = function (ProviderListId)
{
if (confirm('Are you sure you want to delete this?'))
{
var getmsg = AdminService.DeleteProviderDetail(
ProviderListId,
'/Admin/Delete',
function () {
// remove the provider from the list the ng-repeat is bound to
// you could use anything like lodash or underscore to find the
// provider by ID (referencing ProviderListId above)
},
function(err) {
});
return true;
}
else
{
e.stopImmediatePropagation();
e.preventDefault();
return false;
}
}
NOTE: take notice to the comments I added in the success callback. That's your solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With