Back button issue tab app


#1

Hi guys, I am having a ton of weird issues with back button when navigating to child screens on two tabs.

Example:

Goto: Tab1
Goto: Tab1 > Detail
Goto: Tab 2
Goto: Tab 2 > Detail2
Click Tab1
Click Back
It’s goes back to Tab 2

We are using ion-tab (tabs.html)

<ion-tabs class="tabs-icon-only tabs-dark">

<ion-tab title="Home" href="#/tab">
    <ion-nav-view name="tab-home"></ion-nav-view>
</ion-tab>

<ion-tab  href="#/tab/tab1">
    <ion-nav-view name="tab-tab1"></ion-nav-view>
</ion-tab>

<ion-tab  href="#/tab/tab2">
    <ion-nav-view name="tab-tab2"></ion-nav-view>
</ion-tab>

</ion-tabs>

States:

 .state('tab', {
            url: "/tab",
            abstract: true,
            templateUrl: "templates/tabs.html"
        })


.state('tab.home', {
            url: '/home',
            views: {
                'tab-home': {
                    templateUrl: 'templates/tab-home.html',
                    controller: 'HomeCtrl'
                }
            }
        })


  .state('tab.tab1', {
            url: '/tab1',
            cache: false,
            views: {
                'tab-tab1': {
                    templateUrl: 'templates/tab-tab1.html',
                    controller: 'tab1Ctrl'
                }
            }
        })


.state('tab.tab1-detail', {
            url: '/tab1-detail',
            views: {
                'tab-tab1': {
                    templateUrl: 'templates/tab1-detail.html',
                    controller: 'tab1-detailCtrl'
                }
            }
        })


  .state('tab.tab2', {
            url: '/tab2',
            cache: false,
            views: {
                'tab-tab2': {
                    templateUrl: 'templates/tab-tab2.html',
                    controller: 'tab2Ctrl'
                }
            }
        })


.state('tab.tab2-detail', {
            url: '/tab2-detail',
            views: {
                'tab-tab2': {
                    templateUrl: 'templates/tab2-detail.html',
                    controller: 'tab2-detailCtrl'
                }
            }
        })

#2

you have given wrong state…

.state(‘tab.tab1-detail’, {
url: ‘/tab1-detail’,
views: {
‘tab-tab1’: {
templateUrl: ‘templates/tab1-detail.html’,
controller: ‘tab1-detailCtrl’
}
}
})

.state('tab.tab1.tab1-detail…

similarly for tab2 detail state will be 'tab.tab2.tab2-detail