Skip to content

[ui-router] Redirect to child view infinite loop #6

Open
@hjylewis

Description

@hjylewis

One might want to set up a state to redirect to a sub-state using middleware.
Say, /docs always redirects to /docs/getting-started.

When a simple this.redirectTo('parent.child') middleware is written and called when routing to the parent state, it results in an infinite loop.

Example: (caution: crashes page)
https://plnkr.co/edit/syZdLJQ2I8ZomP7T9ndA?p=preview

In this example, there are state one with sub-states, one.one and one.two and state two. Presently, the only middleware used is one that simply calls this.next().

If one changes the middleware at the two lines commented with // Change to 'redirect' middleware to the redirect middleware, one expects that clicking the one and two links redirect to sub-state one.one. The two link performs as expected, but clicking the one link causes an infinite loop.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions