Skip to content

[3.15] Router currentURL Not Set #18665

@jherdman

Description

@jherdman

In Ember 3.12 the following code would report the current URL of the application:

class MyRoute extends Route {
  @service router;

  activate() {
    super.activate(...arguments);
    console.log('here you are:', this.router.currentURL);
  }
}

In Ember 3.15 this will always report null. This is expected to work per RouterService#currentURL. Cursory investigation shows that both currentRouteName nor currentRoute are set either.

Curiously the RouterService reports the correct URL when used within a Component.

Sample application: https://github.com/jherdman/where-art-thou. Note that the console will always log a null URL, whereas the component correctly reports the URL.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions