I have a challenge of creating a quiz where a card is displayed with 4 questions structured like this:
<div class="col-md-6">
<div class="option" id="Answer1">
<label class="Answer1">
<input value= "Answer1"
type="checkbox"
(change) ="CheckAnswer(value)"/>{{question.answer1}}
</label>
</div>
<div class="option" id="Answer2">
<label class="Answer2">
<input value= Answer2
type="checkbox"
(change) ="CheckAnswer(value)"/>{{question.answer2}}
</label>
</div>
<div class="option" id="Answer3">
<label class="Answer3">
<input value= "Answer3"
name="Answer3"
type="checkbox"
(change) ="CheckAnswer(value)"/>{{question.answer3}}
</label>
</div>
<div class="option" id="Answer4">
<label class="Answer4">
<input value= "Answer4"
type="checkbox"
(change) ="CheckAnswer(value);"/>{{question.answer4}}
</label>
</div>
</div>
Currently, my focus is on passing the value of the selected answer to my TS file using the CheckAnswer(value) method. However, when I try to console.log() the value in my method, it keeps showing as undefined.
CheckAnswer(value : string) {
console.log(value);
}