Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9150587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:37:52+00:00 2026-06-17T11:37:52+00:00

I am trying to detect when a route transition occurs. I’ve located this code

  • 0

I am trying to detect when a route transition occurs. I’ve located this code snippet inside the latest version of Ember (v1.0.0-pre.4) that handles the transitions:

  didTransition: function(infos) {
    // Don't do any further action here if we redirected
    if (infos[infos.length-1].handler.transitioned) { return; }

    var appController = this.container.lookup('controller:application'),
        path = routePath(infos);

    set(appController, 'currentPath', path);
    this.notifyPropertyChange('url');

    if (get(this, 'namespace').LOG_TRANSITIONS) {
      Ember.Logger.log("Transitioned into '" + path + "'");
    }
  },

I set up my Ember application as window.App = Ember.Application.create().

I noticed that it calls this.notifyPropertyChange('url');, but I tried to attach an observer to my application App.Router or App.Router.router, I get an error because it does not implement Ember.Observable.

How can I detect when the route path is changed without creating a special Ember.Route for each of my routes?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T11:37:52+00:00Added an answer on June 17, 2026 at 11:37 am

    UPDATED ANSWER

    You can now simply bind an observer on the router’s didTransition event:

    App.Router.reopen({
      doSomethingOnUrlChange: function() {
        console.log(this.get('url'));
      }.on('didTransition')  
    });
    

    see working example: http://jsfiddle.net/Sly7/3THD7/

    DEPRECATED ANSWER BELOW

    In the snippet here, there is set(appController, 'currentPath', path); I think you can put an observer on this property.

    I don’t know exactly where you want to be notified, but it’s possible to do it in the ApplicationController itself.

    App.ApplicationController = Ember.Controller.extend({
    
      currentPathDidChange: function(){
        // the currentPath has changed;
      }.observes('currentPath');
    });
    

    See this working fiddle for example: http://jsfiddle.net/qKrwU/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to detect an http response code of 302. This is my
I'm trying to detect all Images and its paths (Srcs) inside the dynamic containers.
I'm trying to detect emoji in my php code, and prevent users entering it.
I am trying to detect the browser in my C# code by comparing the
I'm trying to detect internet explorer version on remote machine. After some search with
I am trying to detect 7 tablets in my code (i.e. Kindle Fire &
Trying to detect left click vs right click (without using jQuery!) and I have
I am trying to detect groups which contain the difference between first age and
I'm trying to detect and remove those fields that after a sync are still
I am trying to detect when the laptop lid opens and closes, should be

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.