Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

The arguments emitted with route change events are undocumented #10994

@ExplodingCabbage

Description

@ExplodingCabbage

Though the existence of route change events like $routeChangeStart is documented, there is presently no mention I can find in the documentation of the two additional arguments that handlers for these events receive, representing the previous and new route. It is only through Stack Overflow questions like http://stackoverflow.com/questions/11541695/redirecting-to-a-certain-route-based-on-condition, issues like #1907, and a fair bit of experimentation that I am aware of these arguments and what they contain.

Worse still, many useful properties of these objects are provided via their prototypes and don't show up when the objects are logged to the Chrome console, unless you expand the __proto__ property. For example, the .originalPath property does not show up in the console. This seems to have caused genuine confusion; note that the highly upvoted top answerer to this SO question with >130000 views seems not to have realised that the .originalPath property exists, and has recommended detecting which route has been hit via the .templateUrl property. I'm going to try to get that answer improved, but it would help if the official docs were better. The originalPath property isn't currently mentioned anywhere.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions