0

In an Angular2 form submit handler, I have to perform some custom validation. When validation fails, I add the error to the control using …

this.controlname.setErrors({'errorname': true});

This works, but I would also like to focus the control. (Primarily, because the errors are styled in a way that they appear only for the focussed control.)

Is there an elegant way to do this?

BlueM
  • 3,658
  • 21
  • 34

0 Answers0