how to remove specific element from array in angular code example
Example 1: angular delete from array by name
this.data = this.data.filter(item => item !== data_item);
Example 2: angular delete from array by name
deleteMsg(msg:string) {
const index: number = this.data.indexOf(msg);
if (index !== -1) {
this.data.splice(index, 1);
}
}