Skip to content

Feature request: global 'before' check on all state transitions #25

@adamburmister

Description

@adamburmister

I see you've go an onEnter callback. I'd like to request something similar, but at the global level, so all state transitions need to pass the before filters before processing the route.

The main use case I'm thinking about are

  • login-checked
  • has the user completed signup check

I was just sketching out my own ideas for this before googling to find this router project (looks great, can't wait for it) which would look something like this in my head... (obv not using $routeProvider, but you get the point)

$routeProvider
      .before(function($route) {
        if($route.current.secure && !$rootScope.currentUser) {
          // abort the current route
          // force login here
        }
      })

Any appetite for including this sort of functionality within your router project?

I think the big difference over onEnter is the ability to abort routes, and do it on all states

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions