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

both <UISref/> and stateService.go doesn't work properly with state definition #11

Closed
Hotell opened this issue Nov 3, 2016 · 3 comments

Comments

@Hotell
Copy link

Hotell commented Nov 3, 2016

If I have following state definitions where children are defined with parent:

const userListRouteConfig: ReactStateDeclaration = {
  name: 'users',
  url: '/',
  component: UsersPage
};

const userCreateRouteConfig: ReactStateDeclaration = {
  parent: 'users',
  name: 'new',
  url: '/new',
  component: UserCreatePage
};

and UsersPage component with UISref or imperative injected router and relative reference to child:

<MyButton 
  onClick={()=>this.props.transition.router.stateService.go('.new')}
>create new</MyButton>
<UISref to=".new">
  <button>create new</MyButton>
</UISref>

it doesn't transition to new route, even it doesn't throws any error.

this doesn't work as well:

<UISref to="users.new">
  <button>create new</MyButton>
</UISref>

What works, is to explicitly define just the name, which is not very convenient for user, who is in the react component, because, he doesn't immediately know, that the create "new" is a child route

<UISref to="new">
  <button>create new</MyButton>
</UISref>
@christopherthielen
Copy link
Member

christopherthielen commented Nov 7, 2016

When a state is registered, the name provided is used as the basis for all lookups. because of this, if you use theparent: notation, the parent state name is not part of the Child state name and therefore is not used during lookups.

This is something I would consider changing in UI router core. I think there is value in being able to address child states in this way. I need to convince myself that there is no room for ambiguity, however, before this gets implemented.

Related: angular-ui/ui-router#3119

@stale
Copy link

stale bot commented Dec 27, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. This does not mean that the issue is invalid. Valid issues may be reopened. Thank you for your contributions.

@stale stale bot added the wontfix label Dec 27, 2019
@stale
Copy link

stale bot commented Mar 29, 2020

This issue has been automatically closed.

@stale stale bot closed this as completed Mar 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants