Android back button ion-side-menus


#1

Hi

I’m working on ionic application that will be used on android and ios devices. I’m using ion-side-menus.
This is my home screen html code:

<ion-side-menus>
    <ion-side-menu-content>
        <ion-content>
            <div ng-repeat="category in categories" ng-click="display_pages($index)" class="category">
                {{ category.name }}
            </div>
        </ion-content>
    </ion-side-menu-content>
    <ion-side-menu side="left">
        <ion-list>
            <ion-item ng-repeat="page in pages" menu-close>
                <a href="" ui-sref="page({ id: page.id })">{{ page.name }}</a>
            </ion-item>
        </ion-list>
    </ion-side-menu>
</ion-side-menus>

When someone clicks on home screen div - menu opens. There are links to another pages in the menu. When someone clicks on that link - new page opens.
Ewerithing seems to work perfectly despite the fact that on android devices system back button doesn’t work. When user is on the subpage and presses back button - application returns to system.
Everything works ok when i remove ion-side-menus and display links without it. But i have to use this kind of menu…
Somebody can help me? What i’m doing wrong?


#2

The menu-close attribute clears the history. Try replacing it with menu-toggle="left"


#3

Hm. Nothing has changed… Even if I removed it, back button closes application.

I changed the code to:

home.html:

<ion-side-menus>
    <ion-side-menu-content>
        <ion-content>

            <a href="" ui-sref="chat">chat</a>

        </ion-content>
    </ion-side-menu-content>
    <ion-side-menu side="left">

    </ion-side-menu>
</ion-side-menus>

index.html:

<html>
    <head>
       ....
    </head>
    <body ng-app="pokis">
        <ion-nav-view></ion-nav-view>
    </body>
</html>

app.js:

.state('home', {
    cache: false,
    url: '/',
    templateUrl: 'home.html',
})

.state('chat', {
    cache: false,
    url: '/chat',
    templateUrl: 'chat.html',
})

I think this is super simple now. Chat page is empty, without ion-side-menus or even any other html code.

I open the app. I click on chat link and I get empty page. When i click back button - application closes. When i removed ion-side-menus and in home.htm there was only a tag - everything is ok.