2

How can I transform this:

$location.path('/app/home/' + id).search({x:y});

to this:

$state.go('/app/home/' + id).search({x:y});

I tried, but I actually can't get enough information how to achieve that...

Radim Köhler
  • 122,561
  • 47
  • 239
  • 335
itsme
  • 48,972
  • 96
  • 224
  • 345

1 Answers1

11

There is nice documentation (while deprecated, still really clear):

$state.go(to [, toParams] [, options])

Let's say that the state definitions are looking like this:

.state('app', { // parent app
  url: '/app',
  ...
})
.state('app.home', {
  url: '/home/:x',         // the param named x
  ...

Then you will do

$state.go('app.home', {x:y});

This Q&A could help as well:

Community
  • 1
  • 1
Radim Köhler
  • 122,561
  • 47
  • 239
  • 335
  • Great to see that! Enjoy awesome `UI-Router` ;) – Radim Köhler Oct 01 '14 at 09:44
  • @RadimKöhler i need to reload the page after redirecting to page. how to do it in ui-router. i have already tried $state.go('dashboard.places.list', {}, { reload: true}); it is redirecting to the particular view , but not reloads – codelearner Mar 31 '16 at 07:38