Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transition hook criteria from not respecting empty string #32

Closed
christopherthielen opened this issue Jan 21, 2017 · 3 comments
Closed
Labels
Milestone

Comments

@christopherthielen
Copy link
Member

From @adamreisnz on January 19, 2017 22:43

I want to trigger a transition hook which only fires if the user enters a specific state without having a from state, e.g. they land on the page by typing in the URL or following a direct link.

I assumed this would be accomplished via:

$transitionsProvider.onBefore({
    from: '',
    to: 'welcome.*',
  }, transition => { ... });

However, that seems to capture any transition to any welcome.* route, as I suspect the empty from value is being ignored.

Is there another way to have hook criteria match only when there isn't any from state?
If not, can it be implemented so that an empty string (as opposed to undefined / null) triggers this check?

The docs don't document this use case either.

Copied from original issue: angular-ui/ui-router#3285

@christopherthielen
Copy link
Member Author

Agree this is a bug.

@christopherthielen christopherthielen modified the milestones: 4.1.0, 5.0.0 Feb 23, 2017
@christopherthielen
Copy link
Member Author

@adamreisnz I'm unable to reproduce this in angular-ui-router 1.0.0-alpha.1 through 1.0.0-rc.1

http://plnkr.co/edit/dvbViyIbPQ0ZLqbgQRuj?p=preview

Can you please check?

Closing because I cannot reproduce. Reopen if you can reproduce.

@adamreisnz
Copy link

Think it might be working now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants