TypeError: Cannot read property 'valid' of undefined

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

I have the following textarea:


5条回答
  •  生来不讨喜
    2020-12-31 00:10

    In your case content is a property on your model.

    In order to do what you want you need to use a template reference value for the form control #myControl="ngModel" and then you have access to the valid property: myControl.valid.

    So in your example:

    
    

    And use it in the button tag:

    
    

提交回复
热议问题