How to get value of a FormControl in Angular4

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


Having validation at the FormGroup level in the component

this.loginForm = new FormGroup({
  'email': new FormControl('[email protected]', Validators.compose([
    Validators.required,
    Validators.pattern('^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+.[a-zA-Z0-9-.]+$')
  ])),

I was able to pluck the email value like this in my function:

email = this.loginForm.value.email

Worked for me - hope it helps you.

Tags:

Angular