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

$ionicHistory not working for change sideMenu #2802

Closed
sunshineo opened this issue Dec 23, 2014 · 7 comments
Closed

$ionicHistory not working for change sideMenu #2802

sunshineo opened this issue Dec 23, 2014 · 7 comments
Assignees

Comments

@sunshineo
Copy link

I asked this before here #2713 and it got closed. But the solution does not work for me. Now I have a example project here to illustrate the problem.
https://github.com/sunshineo/ionic-sidemenu

I have enable-menu-with-back-views set to true.
screen shot 2014-12-22 at 11 32 50 pm

When the app starts, I'm at http://localhost:8100/#/app/playlists
screen shot 2014-12-22 at 11 45 06 pm

I open the side menu, click "Browse"
screen shot 2014-12-22 at 11 33 50 pm
screen shot 2014-12-22 at 11 45 50 pm

I added a back button that will try to use $ionicHistory to go back. I see the alert but the $ionicHistory.goBack() does not work. It just stays here.
screen shot 2014-12-22 at 11 35 13 pm

However, if I go back to Playlists and do not use the sideMenu but type http://localhost:8100/#/app/browse in the browser I got this:
screen shot 2014-12-22 at 11 43 43 pm
And the back button works.
I'm thinking navigate through the side menu will clear history. But enable-menu-with-back-views is not the flag to stop it from clearing. The documentation seems to say that it is the flag about if you want to have side menu sandwich when you went one level down for example to an item on the Playlist. What I need is to NOT clear history when navigate through side menu.

@mhartington
Copy link
Contributor

For this, you would remove the menu-close attribute.

Note that menu-close will clear the history stack, even if enable-menu-with-back-view is set to true.

menu-close is an attribute directive that closes a currently opened side menu. Note that by default, navigation transitions will not animate between views when the menu is open. Additionally, this directive will reset the entering view's history stack, making the new page the root of the history stack.

Replace menu-close with menu-toggle

http://codepen.io/mhartington/pen/WbovLP

@Ionitron
Copy link
Collaborator

Greetings, @sunshineo!

We are now requiring all issues to be submitted through our custom issue form so that we have all of the information necessary to fix them as quickly as possible.

Your progress on this issue has been saved at the following url:

link to Ionic issue form

This issue will be closed if not resubmitted through the form. Please fill out the rest of the form so that we may assist you.

Thank you for allowing me to assist you.

@sunshineo
Copy link
Author

@mhartington Thank you Mike it works. I feel the documentation here http://ionicframework.com/docs/api/directive/ionSideMenus/ about menu-close could be improved a little. I thought it means if I want the side menu to stay visible on the side for ipad, then I remove it. The documentation here http://ionicframework.com/docs/api/directive/menuClose/ is a little better.
Also it feels to me that clear history is just a side effect of have menu-close. Should we consider separate the functionality into a different directive? Maybe bring back the nav-clear? Why was it removed in the first place?

@Ionitron Noted.

@Lintzman
Copy link

Lintzman commented May 1, 2015

I was having the same issue until I found this post and replaced all my menu-close with menu-toggle="right".

@nerdyorion
Copy link

Hi, you can update your starter sidemenu template to reflect the 'menu-close' to 'menu-toggle' change then.
Got stuck for a little while.

@lentyaishe
Copy link

@mhartington You're the king. Fought with this issue too long and the solution was so easy!

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 4, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants