Skip to content

Instantly share code, notes, and snippets.

@brachi-wernick
Created January 14, 2018 13:12
Show Gist options
  • Save brachi-wernick/06da3513e791737e1518eae416074fc8 to your computer and use it in GitHub Desktop.
Save brachi-wernick/06da3513e791737e1518eae416074fc8 to your computer and use it in GitHub Desktop.
call delete item but send the callback to the api
private removeItem(item: Item) {
let index = this.items.indexOf(item);
//remove the item
this.items.splice(index, 1);
//call back-end server to remove the item from the DB
this.itemService.deleteItem(item.id,()=>this.items.splice(index, 0, item)).subscribe(
//do some stuff);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment