npm install ngx-focus-control --save
Focus if directive
This directive focuses the element when condition bidding changes to True or blurs the element when condition bidding changes to False. Instead of primitive value, you can also pass observable, which focuses element when observable emits True and blur element when observable emits False.
The first example shows input, that should be focused or blurred based on the condition provided. You can change the condition with a button click. The second example shows input, the focused state is determined by a given observable. You can emit True or False with a button click.