TypeError: Cannot read property 'valid' of undefined

后端 未结 5 580
执念已碎
执念已碎 2020-12-30 23:41

I have the following textarea:


5条回答
  •  一生所求
    2020-12-31 00:35

    You could use ngModelChange as a workaround:

    
    

    And in your component:

     detectChanges(newVal, model, validation): void {
         if (validation.valid) model._valid = true;
         else model._valid = false;
     }
    

    This can give you more flexibility when you are using *ngFor to display lots of input fields and want to validate them individually.

提交回复
热议问题