#handling invalid on custom form control component
1 messages · Page 1 of 1 (latest)
ok that works for now. but what if i need more logic to do
nevermind doesnt work. ng-invalid gets appended to all controls under the formgroup
Not sure which form group you're talking about. As always, a complete minimal repro would help.
form = this.fb.group({
field1: ['test', { validators: Validators.required ],
field2: [null, { validators: Validators.required ]
})
in this case both fields gets ng-invalid since theyre under the same form group which is invalid. i need to show the error border on the only on field thats invalid only (field2)