Here is the problem. I get Items with $http.get(url, {cache: true}) and assign to $scope.items. That works fine. Then I delete item in the list. I send $http to delete and then splice item from $scope.items.splice($index, 1). So item deleted from the list.
Now I do to another page of my app. And when I return I see all items including those I deleted.
UserApi.getCoachProfiles().success(function(data) {
if(!data.error) {
$scope.data.profiles = data.result;
}
});
$scope.delete = function(id, index) {
UserApi.deleteProfiles(id).success(function(data) {
if(!data.error) {
$scope.data.profiles.splice(index, 1);
}
});
}
Something like this.
I am using UI Router states.
Aucun commentaire:
Enregistrer un commentaire