Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4830

How to: focus an element when entering in route

$
0
0

@Romgere wrote:

Hi !

I try to achieve a simple thing : Focus an input when user entering in the route.

First I was looking for something similar to didInsertElement for controller, but there is nothing similar.

Then I tried to use the didTransation of the route to call a method on a controller to focus the input, but the didTransation is called before the dom is ready. I can used the didTransation with a call to next (from @ember/runloop) but it looks weird.

Finally I decide to implement it with modifier on the input itself (an auto-focus modifier) & it works well.

But I’m wonder if there is another “ember way” to allow controller to interact with dom element (aka. in the route template) for this kind of purpose ?

Thx !

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4830

Trending Articles