Lets say I have this variable
this.mylist.push([{key:{"test1":name,"test":desc,"hi i am a test":other,"none":type,"amount":0} }]);
This will be added to the array mylist I want however on some condition to remove the current created list by deleting it through the unique key so
I want to splice the object array so the value will be removed to prevent duplicates
I tried
this.mylist.splice(this.mylist.indexOf(key), 1);
But did not work i try to remove the array by getting the unique key which holds these child values
I also tried
this.mylist.splice(this.mylist.indexOf([{key}]), 1);
Someone who can help me out :(
CheckBox(values,values,values) {
this.bool = (this.mylist.indexOf(key) === -1);
if (this.bool) {
this.mylist.push([{key:{"key":key,"naam":naam,"beschrijving":beschrijving,"type":type,"aantal":aantal} }]);
}
else {
this.mylist.splice(this.mylist.indexOf(key), 1);
}
}
The function above is an event when a user clicks on a checkbox. When true the array must be filled with values. Else the array with the unique key must be removed to prevent duplicates