Created
January 14, 2018 13:12
-
-
Save brachi-wernick/06da3513e791737e1518eae416074fc8 to your computer and use it in GitHub Desktop.
call delete item but send the callback to the api
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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