Angular 5 - Can't bind to 'ngFormOptions' since it isn't a known property of 'form'

前端 未结 1 876
时光说笑
时光说笑 2021-01-13 07:33

We just recently updated our application Angular version to v5 and as part of new update Forms support ngFormOptions to configure the validations f

相关标签:
1条回答
  • 2021-01-13 08:15

    As @Andriy mentioned in his comments

    ngForms selector is selector: 'form:not([ngNoForm]):not([formGroup]),ngForm,[ngForm]' - source . Thus, using formGroup directive on form will make this form as NOT ngForm and ngFormOptions will have no affect in this case.

    Alternatively, we can use the said options in `component file as below:

    this.testform = new FormGroup({
          testcontrol: new FormControl('', Validators.required)
    }, {updateOn: 'submit'});
    
    0 讨论(0)
提交回复
热议问题