1

I have a couple of routes/states defined in my application. Consider the standard use case of list view and single view. For my single view, I pass the id as a URL parameter. I want to pass some more data, but not as URL parameters. Can this be done? I use $state.go for transitioning to states.

Edit:

$stateProvider
    .state('list', {
        url: '/list',
        ...
    })
    .state('single', {
        url: '/single/:id',
        ...
    });

I get the id in the $stateParams in the respective controller, from the URL. But I want to send more dynamic data to this route, without sending it through the URL. How would I do it?

Rutwick Gangurde
  • 4,772
  • 11
  • 53
  • 87

1 Answers1

0

You can pass the additional params like this.

  state('state_name', {
        url: 'state_url',
        template: '<template></template>',
        params : params
    })

You can get the values by using the $state.current

$state.current.param
Ramaraj Karuppusamy
  • 2,350
  • 5
  • 24
  • 35