Skip to content

$urlRouterProvider.otherwise issue #1351

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

Closed
ddavyd0v opened this issue Sep 10, 2014 · 5 comments
Closed

$urlRouterProvider.otherwise issue #1351

ddavyd0v opened this issue Sep 10, 2014 · 5 comments

Comments

@ddavyd0v
Copy link

It seems, that otherwise() triggers redirect on invoking child state of an abstract state.
See: http://plnkr.co/edit/UHzkSIBlYVQ0jaYcUTki?p=preview

@christopherthielen
Copy link
Contributor

Hi, sorry this is not currently supported. We are considering adding "default child substate of an abstract state" (#1235), but it is not currently implemented.

The FAQ entry regarding a child substate with url "" is a workaround, but it has issues, such as no ui-sref capability.

Stay tuned to #1235. I think it will be a few releases off, unfortunately.

@ddavyd0v
Copy link
Author

Can you please elaborate what exactly is not supported? This behaviour seems to be a bug. In my plnkr, when I try to invoke child state ('abstractBaz.bar') of an abstract state ('abstractBaz'), "otherwise" redirects me to '/foo'. This is what I consider incorrect.
Regarding the workaround you suggested, can you provide me with a documentation which describes limitations/issues when using {abstract: true}, maybe I just should stop using abstract states altogether.

@christopherthielen
Copy link
Contributor

@Inkp I definitely misunderstood what your plunk was trying to do. I thought you were trying to navigate to the abstract state.

Here's what's happening:

  • click ui-sref
  • goes to abstractBaz.bar
  • sync url
  • url doesn't match so run rules
  • rules say go to foo.

You should either put your URL on the child state

    $stateProvider.state('abstractBaz.bar', {
       url: '/abstractBazBar',     templateUrl: 'bar'
    });

or give the bar state an empty url so the url rules will match

    $stateProvider.state('abstractBaz.bar', {
      templateUrl: 'bar',
      url: ''
    });

@ddavyd0v
Copy link
Author

@christopherthielen, unfortunately, I cannot implement neither one of your suggestions, because I am using {params: []} in my child states. The only viable option I see is to make parent state non-abstract and to redirect to one of the children on the parent state direct activation.
Regarding the subject, I still think this is unclear/incorrect behaviour ('otherwise' triggers when no URL is set in child state of an abstract state). So I guess, something should be done about it.

@illegalnumbers
Copy link

+1 on supporting this feature

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

No branches or pull requests

3 participants