Why dropping and object it does't disappear right away ? I have this peace of code, which deletes object, but it drops only after refreshing the page from web.
One solution would be refresing the page automaticly after deleting, is there any other solution ?
I guess with strings works like that, when using splice(1,$index);
drop is from my factory
app.factory('Inventory', function($resource, $http) {
return $resource('http://someweb.com/api/v1/inventory/:id', {id: "@id"},
{
update: {
method: 'POST',
params: {id: '@id'},
isArray: false
},
save: {
method: 'PUT'
},
query: {
method: 'GET',
params: {id: '@id'},
isArray: false
},
create: {
method: 'POST'
},
drop: {
method: 'DELETE',
params: {id: "@id"}
}
}
);
});
delete function
$scope.deleteInv = function(id) {
for(var i = 0; i < $scope.info.objects.length; i++){
if($scope.info.objects[i].id == id){
Inventory.drop({id: id});
break;
}
}
};