I'm trying to delete object from array by title in this situation, but it doesnt work for me. Also, addItem work properly
addItem() {
console.log(this.item.title + ' ' + this.item.quantity);
this.ListOfUsedMaterials.push({ title: this.item.title, quantity: this.item.quantity});
this.item.title = "";
this.item.quantity = "";
}
//delete from array by title
deleteItem() {
console.log("ID ARTIKLA: ", this.item.title);
for (var i=0; i < this.ListOfUsedMaterials.length; i++) {
if (this.ListOfUsedMaterials[i]["title"] == this.item.title) {
this.ListOfUsedMaterials.splice(i, 1);
}
}
}