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

Route to state with params doesn't work #73

Closed
henrypoon opened this issue Jun 28, 2018 · 2 comments
Closed

Route to state with params doesn't work #73

henrypoon opened this issue Jun 28, 2018 · 2 comments

Comments

@henrypoon
Copy link

henrypoon commented Jun 28, 2018

I am trying to route from react component and implemented as the way mentioned in
#28

It does work for normal state without params in url, however it seems doesn't work for the url with params. Console was showing the error of stateService.js:41 Transition Rejection($id: 2 type: 6, message: The transition errored, detail: Error: Transition Rejection($id: 1 type: 4, message: This transition is invalid, detail: The following parameter values are not valid for state 'contact-detail': [id:"undefined"])) Here's how i implemented

Define state

$stateProvider
  .state('contact', {
     url: '/contacts/:id',
     template: "<contact-detail></contact-detail>"
  })

in react component

  <UIRouterContextComponent>
    <div>
      <UISref to={'contact'} params={{id: 1234}}>
        <a>hello world</a>
      </UISref>
    </div>
  </UIRouterContextComponent>
@henrypoon
Copy link
Author

Solved, it just had a typo

@venkatgude90
Copy link

$stateProvider
.state('action', {
url: 'action/:id',
template: '',
params: {
currentAction: null,
locationUrl: null
},
requireADLogin: login
})

Getting similar error as above. Can you please help me what was the typo that you have identified.

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

2 participants