Skip to content

ui-sref on a parent element breaks all ui-srefs on children #2962

Closed
@rluba

Description

@rluba

Example use case:

  • There’s a table where each row links to a sub-state.
  • For the user’s convenience the whole <tr> is made clickable by adding ui-sref="A" to it.
  • Some of the table columns contain <a> links to other states (implemented by using ui-sref="B" on those link tags).

When you click on any of those links – because you want to visit state B – the link to A on the <tr> elements takes precedence because ui-sref’s click handler does not call e.stopPropagation() when it handles the click event. So the transition to B gets superseded by a transition to A when the parent element processes the event. Therefore, you always end up in state A – no matter where you click.

Adding e.stopPropagation() somewhere in the click handler solves the problem.

Tested with [email protected] and [email protected]

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions