离子:离子导航后退按钮不能向后导航

时间:2016-08-17 13:58:09

标签: angularjs ionic-framework

我的问题是,如果我使用后退按钮没有任何事情发生。所以我的代码背后的想法是,我希望在侧面菜单中的不同选项卡上有不同的视图。这没有问题。但是,如果我从/ groups导航到/ group /:groupId /:groupName后退按钮即将启动,但如果我点击它,它不会导航回/ groups,没有任何事情发生。

的index.html

<body ng-app="JasserApp">

<div class="login-main-container" ng-show="showLogin" ng-controller="LoginCtrl">
    <h5>JAPP</h5>
    <div class="login-main-button-container social-wrap b">
        <button class="facebook" ng-click="facebookSignIn()">Login with Facebook</button>
    </div>
</div>
<!--
  The nav bar that will be updated as we navigate between views.
-->

<div ng-show="!showLogin" ng-controller="MainCtrl">

    <!--
      The views will be rendered in the <ion-nav-view> directive below
      Templates are in the /templates folder (but you could also
      have templates inline in this html file if you'd like).
    -->
    <ion-nav-view></ion-nav-view>


</div></body>

Tabs.html(我认为这是有问题的文件)

    <ion-side-menus>

    <ion-side-menu-content>
        <ion-nav-bar class="bar-stable">
            <ion-nav-back-button>
            </ion-nav-back-button>

            <ion-nav-buttons side="right">
                <button class="button button-icon button-clear ion-navicon" ng-click="toggleRight()"></button>
            </ion-nav-buttons>

        </ion-nav-bar>
        <!-- Main content, usually <ion-nav-view> -->
        <ion-tabs class="tabs-icon-top tabs-color-active-positive">
            <!-- Dashboard Tab -->
            <ion-tab title="Groups" icon-off="ion-ios-pulse" icon-on="ion-ios-pulse-strong" href="#/tab/groups">
                <ion-nav-view name="tab-groups"></ion-nav-view>
            </ion-tab>
            <!-- Chats Tab -->
            <ion-tab title="Account" icon-off="ion-ios-chatboxes-outline" icon-on="ion-ios-chatboxes" href="#/tab/chats">
                <ion-nav-view name="tab-chats"></ion-nav-view>
            </ion-tab>
            <!-- Account Tab -->
            <!--<ion-tab title="Account" icon-off="ion-ios-gear-outline" icon-on="ion-ios-gear" href="#/tab/account">
          <ion-nav-view name="tab-account"></ion-nav-view>
        </ion-tab>-->

        </ion-tabs>
    </ion-side-menu-content>

    <ion-side-menu side="right">
        <ion-nav-view name="sideMenu"></ion-nav-view>
    </ion-side-menu>
</ion-side-menus>

路由视图

     .config(function ($stateProvider, $urlRouterProvider) {

  // Ionic uses AngularUI Router which uses the concept of states
  // Learn more here: https://github.com/angular-ui/ui-router
  // Set up the various states which the app can be in.
    // Each state's controller can be found in controllers.js


  $stateProvider

  // setup an abstract state for the tabs directive
    .state('tab', {
    url: '/tab',
    abstract: true,
    templateUrl: 'templates/tabs.html',
    controller: 'TabCtrl'
  })

  // Each tab has its own nav history stack:

  .state('tab.groups', {
    url: '/groups',
    views: {
      'tab-groups': {
        templateUrl: 'templates/tab-groups.html',
        controller: 'GroupsCtrl'
      },
      'sideMenu':
          {
              templateUrl: 'templates/groups-sideMenu.html',
          }
    }
  })
   .state('tab.group-detail', {
       url: '/group/:groupId/:groupName',
       views: {
          'tab-groups': {
           templateUrl: 'templates/group-detail.html',
           controller: 'GroupsDetailCtrl'
          },
          'sideMenu':
         {
             templateUrl: 'templates/groupDetail-sideMenu.html',
         }
       }
    })

  .state('tab.chats', {
      url: '/chats',
      views: {
        'tab-chats': {
          templateUrl: 'templates/tab-chats.html',
          controller: 'ChatsCtrl'
        }
      }
    })
    .state('tab.chat-detail', {
      url: '/chats/:chatId',
      views: {
        'tab-chats': {
          templateUrl: 'templates/chat-detail.html',
          controller: 'ChatDetailCtrl'
        }
      }
    })

  .state('tab.account', {
    url: '/account',
    views: {
      'tab-account': {
        templateUrl: 'templates/tab-account.html',
        controller: 'AccountCtrl'
      }
    }
  });

  // if none of the above states are matched, use this as the fallback
  $urlRouterProvider.otherwise('/tab/groups');

});

我希望问题很明确。

最好的问候

0 个答案:

没有答案