vendredi 7 mai 2021

Get checked values in dynamic primeng checkbox

I have an array of questions, with each question having a question field and an options field which is essentially an array of string options. The app is being build in Angular.

{

  question: "Is this the question?",
  options: ["yes", "no", "maybe", "not sure"]

}

The questions are received from a service dynamically, and may change over time. The user must have the option to select more than one options, hence I am using a checkbox. Specifically, PrimeNG's checkbox.


<p-checkbox #checkbox class="checkbox-option" [label]="opt.val" [value]="opt.val" value="opt.val">
</p-checkbox>

The question being, which approach should be used in order to receive the checked options of one question at a time. The checkbox would have a submit button below, after which I'll need to check the checked options.

PS. I am new, if anyone needs any other relevant imformation or piece of code, just notify me. Thanks in advance.




Aucun commentaire:

Enregistrer un commentaire