title: Dynamic checkbox in angular 8
body: <p>I am working with dynamic checkbox in angular 8... i am getting checkbox names list  form a method that result i set as array.. and i have binded that array in html.. but when i submit ngform it returns null value. i am adding my code here</p>
  
  <pre><code>additionalCoverArray: Array&lt;AdditionalCovers&gt; = [];
  GetQueryAdditionalCovers() {
      this._getCheckboxvalueService.getCheckBoxValues("GetAdditionalCovers").then(result =&gt; {
        this.checkBoxes = result;
        this.additionalCoverArray = this.checkBoxes;
        console.log(this.additionalCoverArray);
      });
    }
  in html
  div class="additionalcovers-form"&gt;
      &lt;form #additionalCoversForm="ngForm" class="col-md-12" (ngSubmit)="onSubmit(additionalCoversForm.value)"&gt;
        &lt;div class="row" *ngIf="additionalCoverArray"&gt;
          &lt;div class="col-md-6"&gt;
            &lt;div class="row"&gt;
              &lt;div class="col-md-6" *ngFor="let objCheckbox of additionalCoverArray; let i=index"&gt;
                &lt;input type="checkbox"   [(ngModel)]="objCheckbox.isMandatory" id="{{objCheckbox.displayValue}}" name="{{objCheckbox.displayValue}}" value="{{objCheckbox.displayValue}}" (change)="toggleVisibility($event)"&gt;
                &lt;label&gt;{{ objCheckbox.displayValue }}&lt;/label&gt;
              &lt;/div&gt;
              &lt;div class="col-md-6"&gt;
                &lt;label&gt;No Years&lt;/label&gt;
                &lt;select (change)="change($event)" [(ngModel)]="noYearsArray.noYears" name="noYears" [ngModelOptions]="{standalone: true}"&gt;
                  &lt;option *ngFor="let objNoYears of noYears" [value]="objNoYears.displayValue"&gt;{{objNoYears.displayValue}}&lt;/option&gt;
                &lt;/select&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
  </code></pre>