Wednesday, April 25, 2018

[formGroup] at a form tag in an Angular 4 app

The form I elude to here would have a front end template that starts out like so:

<form [formGroup]="presidentsForm">
   <div class="headerWrapper">
      <div class="headerRight">
         Nonconsecutiveness?
      </div>
      <div class="headerMiddle">
         Party
      </div>
      <div class="headerLeft">
         Name
      </div>
   </div>
   <ng-container formArrayName="lineItems">
      <div *ngFor="let lineItem of presidentsForm.get('lineItems').controls; let i=index"
            [formGroupName]="i" class="lineItem">

 
 

Inside of the *ngFor we would have controls like so:

<input type="text" formControlName="name" />

No comments:

Post a Comment