Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

delete in typescript with a toaster notification

constructor(
    private toastr: ToastrService
  ) { }

deletePost1(id:number) {
    this.messageService.delete(id).subscribe(res => {
        this.messages = this.messages.filter(item => item.id !== id);
        this.toastr.success("Post deleted successfully!", 'success', { timeOut: 2500 });

    })
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #delete #typescript #toaster #notification
ADD COMMENT
Topic
Name
8+9 =