I need to delete a row from my table but I don't want to reload or refresh all my table in order to see the updated rows.
var demoApp = angular.module("demoApp", ["ngResource"]);
// Controller
demoApp.controller("categoryController", function($scope, deleteCategorieService, categoriesService){
$scope.categories = categoriesService.query();
$scope.deleteCategory = function(id){
deleteCategoryService.deleteCategory({id: id});
// I want to avoid this method to refresh my table.
// $scope.categories = categoriesService.query();
};
});
// Factories
demoApp.factory("deleteCategorieService", function($resource){
return $resource("/demopro/deleteCategory/:id", {}, {
deleteCategory: {
method: "DELETE",
params: {id: "@id"}
}
});
});
demoApp.factory("categoriesService", function($resource){
return $resource("/demopro/categories", {}, {
listAllCategories : {
method: "GET",
isArray: true
}
});
});
How can I do that?