npm install ngx-focus-control --save
Focus switch, case and default directive
Focus switch directive on parent element with some variable focuses child element with the value provided in focus case directive that matches. It matches the first element from top to bottom. If there is no match and you use the focus default directive, the element with this directive is focused. Value needs to change, to focus the element (if the switch variable has got value 0, and you set the variable again to 0, the element will not be focused). You can also pass observable into focus switch directive (works similar as in focus if directive).
Example shows 4 inputs, that should be focused based on the variable provided in the focus switch. You can change the variable with a button click.