Skip to content

Instantly share code, notes, and snippets.

@karptonite
Created November 4, 2013 19:27
Show Gist options
  • Save karptonite/7307862 to your computer and use it in GitHub Desktop.
Save karptonite/7307862 to your computer and use it in GitHub Desktop.
Restangular issue
Click a delete button. Get the confirm dialog box. Click yes.
Console logs "deleting [id]" and "done".
If I click delete again, or anything else, THEN the Restangular remove fires and sends the delete request.
$scope.delete = function( id ){
StickyWin.confirm( "Confirm", "Are you sure you want to delete this contest?", function(){
console.log( 'deleting' + id );
Restangular.one( 'contests', id ).remove().then(function(){
console.log( 'deleted' );
Restangular.all( "contests" ).getList().then( function( response ){
console.log( 'resetting');
$scope.contests = response;
});
});
console.log('done');
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment