alt
alt

Reputation: 13927

Ember.js after transition from callback

I'd like to execute a function after the view has loaded transitioning from a specific route.

Does Ember have a callback for this?

I can get it to work if I do a setTimeout on the click event of all anchors on that route:

didInsertElement: ->
    $('a').on 'click', (e) ->
      setTimeout ->
        console.log $(":hover")
      , 1000

But setTimeout isn't reliable.

Upvotes: 1

Views: 589

Answers (1)

herom
herom

Reputation: 2542

If you initiated the transition yourself by calling transitionTo you're able to use promises, since the transitionTo method returns a Promise as you can read in this post from machty which gives a very good explanation & insight of the "router facelift": https://gist.github.com/machty/5723945

Upvotes: 1

Related Questions