How to get value of a FormControl in Angular4

前端 未结 3 1553
伪装坚强ぢ
伪装坚强ぢ 2021-02-19 06:18

I have some experience in Angular4, but I just inherited a piece of code that uses FormControls, and I don\'t know how to work with them. I am setting up a comments textarea th

3条回答
  •  孤独总比滥情好
    2021-02-19 07:10

    you can do this.rotationForm.get('comments').value this will give you the value of the formControl and then you can check on the length.

    doing this this.rotationForm.value.comments will work too BUT NOT for disabled fields, to get the value of the DISABLED fields use the this.rotationForm.get('comments').value

提交回复
热议问题