ui-router: $state.reload does not work if state have reloadOnSearch:false

My website has a header which contains a search field. This header is always shown, doesn’t matter which state is the current state. When one submit the search form, they are redirected to search state with term param.

The search page (state) shows pagination widget, so when user clicks page 2, I change the query string but don’t reload the state (that’s why I use reloadOnSearch:false). However, the search form is still in the page. If user submits another search, only the term parameter will change and because of that, the page will not be reloaded. But I need to reload the page if user submits the search again.

I’ve created a simple plunker to demonstrate.

I think $state.reloadshould reload the state, even if it has reloadOnSearch:false. I’m migrating from ngRoute, and $route.reload() reload the route even if it has reloadOnSearch:false.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 23 (6 by maintainers)

Most upvoted comments

My workaround for this issue

$state.current.reloadOnSearch = true;
$state.go($state.current, {year:  date.year(), month: date.month() + 1, day: date.date(), filter: 'day'}).then(function(){
     $state.current.reloadOnSearch = false;
 });