I'm not intending to come as a smart a**. I apologize if that is the way 
I'm coming off. That is not my intention.

On Friday, March 12, 2021 at 6:13:00 AM UTC-5 Todd Zmijewski wrote:

> public form: FormGroup = new FormGroup({
> doBetterAtNaming: new FormControl('', [Validators.required, 
> Validators.max(1)])
> });
>
> get doBetterAtNaming(): FormControl {
>   return this.form.get('doBetterAtNaming');
> }
>
> On Friday, March 12, 2021 at 6:11:16 AM UTC-5 Todd Zmijewski wrote:
>
>> I also wouldn't recommend naming the control control. That is really 
>> confusing. What is the purpose/context of the control. Name it that. Not 
>> control.
>>
>> On Friday, March 12, 2021 at 6:09:55 AM UTC-5 Todd Zmijewski wrote:
>>
>>> Typically the reason you see that in tutorials and what not is because 
>>> getters are defined for the control.
>>>
>>> On Friday, March 12, 2021 at 6:02:25 AM UTC-5 Todd Zmijewski wrote:
>>>
>>>> god darnit....
>>>>
>>>> get control(): FormControl {
>>>>   return this.form.get('control');
>>>> 
>>>> }
>>>> On Friday, March 12, 2021 at 6:01:24 AM UTC-5 Todd Zmijewski wrote:
>>>>
>>>>> 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/3ea516a3-28da-46fe-ae94-73030abbe730n%40googlegroups.com.

Reply via email to