angular.js - ionic的side menu和tabs结合的路由怎么设置?
过去多啦不再A梦
过去多啦不再A梦 2017-05-15 17:02:10
0
1
461

我是用ionic的tab默认模板,然后需要加side menu这个功能,但是我在设置路由的时候不知该如何设置,是应该在tab下面接着这样写?

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

但是每次这样都会跳转到首页面,而只有title显示出来,内容区域号线被首页的盖住了,因此我新建了一个模板,为menu.html,我这样定义了路由

.state('menu',{ url:'/menu', abstract:true, templateUrl: 'templates/menu.html' }) .state('tab', { url: '/tab', abstract: true, templateUrl: 'templates/tabs.html' }) // Each tab has its own nav history stack: .state('tab.dash', { url: '/dash', views: { 'tab-dash': { templateUrl: 'templates/tab-dash.html', controller: 'DashCtrl' } } }) .state('menu.login',{ url:'/login', views:{ 'menu-login':{ templateUrl:'templates/login.html', controller:'LoginCtrl' } } })

但是却没有了切换动画效果,这是什么原因?

过去多啦不再A梦
过去多啦不再A梦

reply all (1)
習慣沉默

It should be enough to add a nested sub-route.

.state('tab.dash', { url: '/dash', abstract:true,//设为抽象 views: { 'tab-dash': { templateUrl: 'templates/menu.html', controller: 'MenuCtrl' } } }) .state('tab.dash.firstPage', { url: '/firstPage', views: { 'side-menu': { templateUrl: 'templates/firstPage.html', controller: 'MyCtrl' } } }) $urlRouterProvider.otherwise('/tab/dash/firstPage');//跳转到首页

The content in menu.html is the menu.html template in the original side menu project, and then just change the view name menuContent to side-menu.

    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!