带有ReactiveFormModule的Angular FormArray验证错误

时间:2019-09-16 07:27:03

标签: angular angular8

this.billingForm = this.fb.group({
      "fullname": [null, [Validators.required, Validators.pattern('.*\\S'), Validators.minLength(3)]],
      "address1": [null, [Validators.required, Validators.pattern('.*\\S')]],
      "address2": [null, Validators.pattern('.*\\S')],
      "city": [null, [Validators.required, Validators.pattern('.*\\S')]],
      "state": [null, Validators.pattern('.*\\S')],
      "zipcode": [null, Validators.pattern('.*\\S')],
      "country": [null, Validators.required],
      "taxId": [null, [Validators.required, Validators.pattern('.*\\S')]],
      "contacts": this.fb.array([this.contactDetail()], [Validators.required, Validators.pattern('.*\\S')])      
    });

Validators.pattern('。* \ S')不能与表单数组一起使用,并且可以用于其他控件。

0 个答案:

没有答案