How can I gather all the checkbox values from my list and combine them into a single variable?
This is the structure of my HTML:
<div class="card" *ngFor="let event of testcases" >
<input class="form-check-input" type="checkbox" value="{{event.upload}}" id="flexCheckDefault">
{{event.name}}
<h5 class="mb-0">
</h5>
</div>
I am looking to concatenate the "{{event.upload}}" values of the checkboxes I have checked into one variable. How can I achieve this?
For example, if my list looks like this:
testcases= [
{
name: 'C001',
upload: 'Photography',
},
{
name: 'C002',
upload: 'Writing',
},
{
name: 'C003',
upload: 'Painting',
},
]
And if I were to check off the first two options, I would like the resulting string to be: "Photography Writing"