Skip to content

RFC: Nested state support for ui-sref-active #704

Closed
@MrOrz

Description

@MrOrz

It is mentioned in #635 and #19 that ui-sref-active will support nested state in the future, but I could not find the details discussed anywhere. As I browse the current source code, I found that it is actually not hard to achieve, and that it would seem redundant if I create another directive just for supporting nested states.

Since I need this feature right away, I've implemented a quick and dirty way to meet my need: when an extra html attribute ui-nested is present, ui-sref-active would use $state.includes instead of strict equality on the states.

Demo: http://plnkr.co/edit/CWUy3T0M7dTap75hASkk?p=preview

This can be achieved by merely changing 1 line (yeah I'm only capable of making a modification <= 4 lines... :P)
https://github.com/MrOrz/ui-router/compare/ui-nested

Hope that through this little dirty hack, we can initiate a discussion on how this function should be properly implemented.

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