Whenever the button is clicked, a new select option is added. On removal, the last member of the array is deleted. The goal now is to transfer the selected value to a list below.
This snippet showcases the code in question:
$scope.langInput = {
count: 3,
values: [1, 2],
add: function() {
this.values.push(this.count);
this.count += 1;
console.log(this.values);
},
remove: function() {
this.values.pop();
this.count -= 1;
console.log(this.values);
}
};
Here's a working demo of the provided code. There's still an issue with moving the selected option to the <ol>
list. Any tips would be greatly appreciated.