Skip to content

Aborted transition clears state params #94

Closed
@wbkostan

Description

@wbkostan

Issue: When a transition is started due to a $location change (e.g. browser back button), and then that transition is aborted before completing, the query parameters on the 'from' state are lost.

Expected: The transition should abort leaving the user on the 'from' state with all query parameters at their pre-existing values.

Plunker: http://plnkr.co/edit/CnMxoHS0EmHdy58xRkbg?p=preview

Details: It looks like the core problem is between stateService.ts and urlRouter.ts. When stateService handles aborted transitions, it calls urlRouter.update() to re-sync the url to the current state. Since the transition was initiated via a $location change, the path != the stored location. This has the net effect of updating the url to match the stored location; however, only the $url.path() is stored (not the query params).

If user was at /foo?id=1, this has the effect of updating url to /foo which initiates a second transition from /foo?id=1 to /foo, clearing the parameters from the state.

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