
    <form nz-form [formGroup]="validateForm" (ngSubmit)="submitForm()">
      <ng-container formArrayName="names">
        @for (control of listOfControl.controls; track control; let i = $index) {
          <nz-form-item>
            @if (i === 0) {
              <nz-form-label [nzXs]="24" [nzSm]="4" [nzFor]="'passenger' + i"> Passengers </nz-form-label>
            }
            <nz-form-control
              [nzXs]="24"
              [nzSm]="20"
              [nzOffset]="i === 0 ? 0 : 4"
              nzErrorTip="Please input passenger's name or delete this field."
            >
              <input
                class="passenger-input"
                nz-input
                placeholder="placeholder"
                [attr.id]="'passenger' + i"
                [formControlName]="i"
              />
              @if (listOfControl.controls.length > 1) {
                <nz-icon nzType="minus-circle-o" class="dynamic-delete-button" (click)="removeField(i, $event)" />
              }
            </nz-form-control>
          </nz-form-item>
        }

        <nz-form-item>
          <nz-form-control [nzXs]="{ span: 24, offset: 0 }" [nzSm]="{ span: 20, offset: 4 }">
            <button nz-button nzType="dashed" class="add-button" (click)="addField($event)">
              <nz-icon nzType="plus" />
              Add field
            </button>
          </nz-form-control>
        </nz-form-item>
        <nz-form-item>
          <nz-form-control [nzXs]="{ span: 24, offset: 0 }" [nzSm]="{ span: 20, offset: 4 }">
            <button nz-button nzType="dashed" class="add-button" (click)="addHeadField($event)">
              <nz-icon nzType="plus" />
              Add field at head
            </button>
          </nz-form-control>
        </nz-form-item>
        <nz-form-item>
          <nz-form-control [nzXs]="{ span: 24, offset: 0 }" [nzSm]="{ span: 20, offset: 4 }">
            <button nz-button nzType="primary">Submit</button>
          </nz-form-control>
        </nz-form-item>
      </ng-container>
    </form>
  