I have my Mean stack delete functioning properly; however, I can't seem to figure out how to update the view with the updated JSON once deleted.
My express server side logic:
.delete(function(req, res) {
Service.remove({
_id: req.params._id
}, function(err, service) {
if (err)
res.send(err);
res.json({ message: 'Successfully deleted' });
});
});
My angular controller
$scope.removeItem = function(id) {
$http.delete('/api/hc/' + id)
.success(function(data) {
$scope.services = data;
console.log(data);
})
.error(function(data) {
console.log('Error: ' + data);
});
};
My angular template calling the function
<a ng-click="removeItem(service._id)">Remove</a>