$state.go() problem. I NEED HELP!

Is it possible for $state.go("") not to push new view to the right?

I have sidemenu with menu item 1 and menu item 2.

I have a button that will do $state.go(menu1) within menu item 2’s view, and rather than push new view to the right, is it possible to just directly go to menu item 1’s view?

Hope that make sense… Here is drawing that will help.

In case of that you need to set the nextViewOptions with the $ionicHistory-Service, before you are routing to menu1view.

  disableAnimate: true,
  disableBack: true,
  historyRoot: true

so you have no page transition --> because your states are on the same level in your navigation structure --> because they are on Level1 --> you do not need a backbutton --> and because of that menu1view should become the new historyRoot :slight_smile:

1 Like

Great, will try that and let you onow what i come up with

@bengtler would this apply to the whole app!?

It seems like it did not for me.? Should i make the setting to go back to default?

This sets those options only for the next state change.

so you have to set a ngClick to your button, that redirects to menu1view.
In this function you do the stuff i posted in my last post ($ionicHistory.nextViewOptions(…)…).

@bengtler but how do you know its only for 1 time state change with the code? Btw its working great.

because thats how the function nextViewOptions() works and is intended to work :wink:

1 Like