Home > Software design >  Way to subscribe to an angular FormGroup getting focused in and out
Way to subscribe to an angular FormGroup getting focused in and out

Time:09-16

I would like to know if any input inside an angular FormGroup did get focused in or out and set it into a variable like focused: boolean

I could add (focus) to every inputs, but it seems a bit dirty.

Is it somehow doable ?

Objective

I'm trying to hide some information when the user is typing on the smartphone, because the keyboard do take a lot of place.

CodePudding user response:

you could use single subscribtion on the parent, but instead of focus event you can subscribe to focusin event. and because it bubbles, the parent element will catch this event on all of its children

  • Related