I am displaying to the user a series of divs with content in them and the user is able to remove the div from the page so that they no longer see it.
I would like to take the same div content that was removed from an array and add it into another array that will be used to populate a dropdown list.
this is what i have:
//Remove function
removeCategory(index: number): void {
this.categories.splice(index, 1);
}
//Array
categories: Array<Item> = [
new Item(1, 'test1'),
new Item(2, 'test2')
];
//New Array to add previous removed item
ddoptions: Array<object> = [];
Is it possible to do a push statement before the splice in the removeCategory function? I am not sure of what to pass in since doing this gives me an error:
this.ddoptions.push(index);
splicereturns. The code above is too fragmentary to show you exactly where to put it, but that should be more than enough to get you there.