I replaced my simple
<a href="#id">Get notified!</a>
with calls to $anchorScroll
during my transition to AngularJS as described in Angular JS - Scrolling To An Element By Id and How to handle anchor hash linking in AngularJS
This however has broken a nice feature. The href #id
pointed to an input field. The new $anchorScroll
behaviour scrolled to this element but did not focus it.
Is there a way to focus it? It makes this feature quite useless if I am unable to jump right to a field and start typing. Edit: Ok, is there a way with AngularJS. I want to get away from plain old JS, as far as I can.
Here is a plunker that is taken from $anchorScroll
docs, the target is now an input field, but scrolling to it does not focus it Plunker