Skip to content

Don't keep stateParams when transitioning between unrelated states #930

@ghengeveld

Description

@ghengeveld

When following links created by uiSref, any params present on the current state will be retained. This can lead to broken links since not all pages have the same params, and if they do the possible values may differ.

I suggest not keeping the stateParams when transitioning between two states that aren't in the same hierarchy (e.g. they or their ancestors are siblings).

My app has several unrelated pages with params for sorting/filtering/pagination. It doesn't make sense to have these params be retained between unrelated pages. Right now I've defined a 'clearParams' object which has all the params set to undefined, which I pass to uiSref. That works but it's ugly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions