title: Get values from a Reactive Form check box
body: <p>Good, I am implementing a Reactive Form, but I have a problem getting the values from the checkbox, only the value of the first of the value I select appears and not the others. I attach my code:</p>
  
  <p><strong><em>Component.ts</em></strong></p>
  
  <pre><code>registerForm: FormGroup;
  
    builder(
       private Restservice: RestserviceService,
       private route: ActivatedRoute,
       private router: Router,
       private formBuilder: FormBuilder
     ) {
  
       this.registerForm = this.formBuilder.group ({
         text: [""],
         checkArray: [""],
         radiobutton: [""],
         array: [""],
         list: [""],
         archive: [""],
         date: [""],
         numeric: [""],
         CommonData: [""],
       });
     }
  
  // I show the values of the Form
    submit () {
       if (this.registerForm.valid) {
         console.log ("complete", this.registerForm.value);
         // this.createAnswers ();
       } else {
         alert ("FILL ALL FIELDS");
       }
     }
  </code></pre>
  
  <p>I use primeng's p-checkbox here but the problem is that it only recognizes the first value selected and the others don't.</p>
  
  <p> <strong><em>Html</em></strong>.</p>
  
  <pre><code>&lt;div *ngIf="p.codigo_tipopreguntas == 2"&gt;
                              &lt;ng-container *ngFor="let v of valores; let i=index"&gt;
                                &lt;div *ngIf="p.id === v.codigo_pregunta"&gt;
                                    &lt;p-checkbox  value="{{v.preguntas_valor}}"
                                      label="{{v.preguntas_valor}}" formControlName="checkbox"&gt;&lt;/p-checkbox&gt;
                                &lt;/div&gt;
                              &lt;/ng-container&gt;
                            &lt;/div&gt;
  
   &lt;button class="btn btn-info btn-just-icon btn-round btn-link" pTooltip="Guardar" tooltipPosition="top"
                (click)="submit()"&gt;
                &lt;i class="material-icons"&gt;remove_red_eye&lt;/i&gt;
              &lt;/button&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/UPQOf.png" rel="nofollow noreferrer">attached picture of what the submit function prints</a></p>