如何制作"后退按钮"出现,对于子视图?

时间:2018-02-22 02:03:30

标签: javascript angularjs ionic-framework

我是离子的新手,导致我最困难的是导航的主题。 我有两个名为" Dashboard"和#34;朋友"。我希望当我点击仪表板按钮时,我可以导航到名为" subview_dash"的子视图,但我不希望在此视图中显示选项卡。我的问题是我知道如何导航到这个视图,但我不能让返回按钮显示在" subview_dash"。

enter image description here enter image description here

我该怎么办?我也很感激。

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

  // Each tab has its own nav history stack:

  .state('tab.dash', {
    url: '/dash',
    views: {
      'tab-dash': {
        templateUrl: 'tab-dash.html',
        controller: 'DashCtrl'
      }
    }
  })

  .state('tab.friends', {
    url: '/friends',
    views: {
      'tab-friends': {
        templateUrl: 'tab-friends.html',
        controller: 'DashCtrl'
      }
    }
  })

  .state('subview_dash', {
    url: '/subview_dash',
        templateUrl: 'tab-subview_dash.html',
        controller: 'DashCtrl'

  }) 

这是我的代码:

http://plnkr.co/edit/Az3w9O8rkr7fJw4unIDz?p=preview

1 个答案:

答案 0 :(得分:1)

您可以在tab-subview_dash.html

中使用此代码
<ion-view title="subview_dash">
    <ion-nav-buttons side="left">
      <button class="button button-clear ion-arrow-left-c" ng-click="backButton()"></button>
    </ion-nav-buttons>
    <ion-content class="has-header">
       friends
    </ion-content>
</ion-view>

并为backButton()编写函数,给出要重定向的路径

相关问题