Skip to content

Document how to access the state from controllers and templates #1482

@dandv

Description

@dandv

Maybe this is too obvious to merit documentation, but as someone new to ui-router, I can't seem to find how to access the state from a template so I can ngSwitch based on it. Likewise, how does one access the state from a controller? Is this documented somewhere? Thanks!

NB: I found $state.current.name available in controllers but this seems undocumented.

How about templates? Do I need to specifically expose $state.current.name into $scope?

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