如何修复ngBuild上的formControls错误?

时间:2019-04-07 20:51:41

标签: javascript angular angular-reactive-forms

在ng服务中一切正常,但是当我运行ng build时出现错误

ERROR in src/app/components/test/test.component.html(27,14): : Property 'controls' does not exist on type 'AbstractControl'.

该代码中的错误:

<div class="answers">
        <div *ngFor="let control of addTestFormGroup.controls.answers.controls, let i = index"
             class="answers">
            <mat-form-field>
                <mat-radio-button class="correct"
                                  (change)="checkCorrect($event)"
                                  [value]="control.value"></mat-radio-button>
                <input [formControl]="control"
                       placeholder="Possible answer"
                       matInput type="text">
                <mat-icon *ngIf="addTestFormGroup.controls.answers.controls.length > 3"
                          (click)="removeAnswer(i)"
                          class="mat-18 delete">delete</mat-icon>
            </mat-form-field>
        </div>
    </div>

0 个答案:

没有答案