微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

angular-ui-router – 离子选项卡导航问题

我正在使用Ionic框架和IU路由器为您的第一个Web应用程序提供更好的导航.

这里有一个简单的架构,因此您可以轻松地了解结构:

我面临的问题是,当我在标签之间导航时,我无法保持状态.例如.当我进入下一个标签并单击下一个视图并按回车键,然后我导航到第一个按钮,当我回到第二个标签时,我看不到我离开的相同状态.

我无法解决这个问题.

这是一个DEMO:PLUNKER DEMO + CODE

这是我的州代码

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


$stateProvider



    .state('live.today',{
  url: '/today',views: {
    today: {
      templateUrl: 'today_live.html',}
  }
})

 .state('live.yesterday',{
  url: '/yesterday',views: {
    yesterday: {
      templateUrl: 'yesterday_live.html'
    }
  }
})

 .state('live.tomorrow',{
  url: '/tomorrow',views: {
    tomorrow: {
      templateUrl: 'tomorrow_live.html'
    }
  }
})



 .state('match.composition',{

  url: '/composition',views: {
    view: {
      templateUrl: 'composition.html'
    }
  }
})

 .state('match.resume',{
    cache: false,url: '/resume',views: {
    view: {
      templateUrl: 'resume.html'
    }
  }
})

 .state('live',{

  url: '/live',views: {
    live_view: {
      templateUrl: 'live.html'
    }
  }
})

.state('match',url: '/match_details',views: {
    live_view: {
      templateUrl: 'match_details.html'
    }
  }
})

.state('news',url: '/news',views: {
    news: {
      templateUrl: 'news.html'
    }
  }
})




$urlRouterProvider.otherwise('/live/today');


})
最后,我找到了一个解决方案,即将“< ion-content>< / ion-content>”添加我有三个选项卡(live.html)的文件中.

对于拥有相同复杂视图架构的人,您可以在更新的演示中获取战利品

原文地址:https://www.jb51.cc/angularjs/141149.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐