我收到错误: TypeError:无法创建属性'验证器'在字符串'控制'"
CNContactPickerViewController
模板看起来像这样。
import { Component, ChangeDetectionStrategy, OnInit } from '@angular/core';
import { CommonModule } from '@angular/common';
import { BrowserModule } from '@angular/platform-browser';
import { DataStorageService, FieldConfig, ImportType } from '../../../../services/datastorage.service';
import { ReactiveFormsModule, FormGroup, FormArray, FormControl } from '@angular/forms';
import * as Papa from 'papaparse';
@Component({
selector: 'field-analysis',
templateUrl: './field-analysis.component.html'
})
export class FieldAnalysisComponent implements OnInit {
fieldsGroup;
ngOnInit() {
this.fieldsGroup = new FormGroup({ fieldset: new FormArray([new FormControl(''), new FormControl('')]) });
}
}
答案 0 :(得分:4)
您将字符串fieldsGroup
传递给 FormGroupDirective 。您应该通过FormGroup
实例:
[formGroup]="fieldsGroup"
FormControlDirective 也需要FormControl
个实例
[formControl]="control"