Skip to content

Commit

Permalink
fixed timing issue with insert/delete
Browse files Browse the repository at this point in the history
  • Loading branch information
jstrachan committed Aug 14, 2012
1 parent 98e5327 commit 4be59f5
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions samples/chat-angularjs/src/main/webapp/js/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,18 @@ function ProductController($scope, $resource, $location) {
}

$scope.delete = function (formData) {
console.log('deleting ' + formData);
$scope.elementResource(formData).delete();
// lets force a reload
$scope.results = Model.get();
$scope.elementResource(formData).delete(function() {
// lets force a reload
$scope.results = Model.get();
});
};

$scope.save = function (formData) {
new Model(formData).$save();
$scope.reset();
// lets force a reload
$scope.results = Model.get();
new Model(formData).$save(function() {
$scope.reset();
// lets force a reload
$scope.results = Model.get();
});
};
}

Expand Down

0 comments on commit 4be59f5

Please sign in to comment.