Do you have a getter for the control?

control is not a property of the component. Either you need to create a 
getter or explicitly reference the control.

view:

form.get('control').touched && form.get('control').invalid

or

component class:

get control(): FormControl {
  return form.get('control');
}

On Friday, March 12, 2021 at 5:42:06 AM UTC-5 john.mb...@gmail.com wrote:

> Hi,
>
> So, in my Angular reactive forms, I am binding my form control to my 
> component and in each component I have the following:
>
> ```
> public form: FormGroup = new FormGroup({
> control: new FormControl('', [Validators.required, Validators.max(1)])
> });
> ```
> I have added this into select dropdown in my HTML: 
>
> [ngClass]="{ 'is-invalid': control.touched && control.invalid }"
>
> I am not seeing is-invalid, am I doing something wrong?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/angular/b8dc80b5-0abe-47d4-853a-735d64b4f404n%40googlegroups.com.

Reply via email to