IONIC----08.route_menu_tab
2016-07-29 09:53
204 查看
<!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no,width=device-width,height=device-height"> <script src="./lib/js/ionic.bundle.min.js"></script> <link rel="stylesheet" type="text/css" href="./lib/css/ionic.min.css"> <title>Ionic</title> </head> <body ng-app="myApp"> <ion-nav-view></ion-nav-view> </body> </html> <!-- <script src="./js/app.js"></script> <script src="./js/controller.js"></script> --> <script> //可独立app.js angular.module('myApp', ['ionic','myApp.controllers']) .config(function($stateProvider, $urlRouterProvider) { $stateProvider .state('tab', { //定义一个路由,其它路由可以继承这个路由 url: "/tab", abstract:true, templateUrl: "templates/tabs.html" }) .state('tab.tab1', { url: '/tab1', views:{ 'tab-tab1':{ templateUrl: "templates/tab-tab1.html", controller:'tab1Controller' } } }) .state('tab.tab2', { url: '/tab2', views:{ 'tab-tab2':{ templateUrl: "templates/tab-tab2.html", controller:'tab2Controller' } } }) .state('tab.tab3', { url: '/tab3', views:{ 'tab-tab3':{ templateUrl: "templates/tab-tab3.html", controller:'tab3Controller' } } }) .state('tab.content1', { url: '/content1/:id', views:{ 'tab-tab1':{ templateUrl: "templates/tab-content1.html", controller:'content1Controller' } } }) //无返回按钮 .state('news', { url: '/news', templateUrl: "templates/news.html" }) //有返回按钮-路由要继承tab--href="#/tab/news" .state('tab.news', { url: '/news', views:{ 'tab-tab1':{ templateUrl: "templates/news.html" } } }) // if none of the above states are matched, use this as the fallback $urlRouterProvider.otherwise('/tab/tab1'); }); //可独立controller.js angular.module('myApp.controllers', []) .controller('tab1Controller', function($scope){ $scope.title='tab1Controller'; }) .controller('tab2Controller', function($scope){ $scope.title='tab2Controller'; }) .controller('tab3Controller', function($scope){ $scope.title='tab3Controller'; }) .controller('content1Controller', function($scope,$stateParams){ $scope.title='content1Controller'; console.log($stateParams); }) </script>
GITHUB
相关文章推荐
- dwz点击menu菜单,不清除tab
- Understanding Ionic’s Side Menu
- (翻译)A hidden tab menu--完全采用CSS
- ExtTabMenu 控件
- ionic之手动控制tab跳转
- tabmenu popupwindow
- ionic入门教程第十九课-ionic路由详解(state、route、resolve)
- ionic 底部tab模块切换,使用背景图片
- ionic原生tab。使用懒加载的同时不把tab拿出来单独做一个组件
- Menu、MultiView和View 合作做的tab效果
- ionic-侧边菜单$ionicSideMenuDelegate
- Android学习之Tab控件(使用TabHost和与Tab对应的Menu,动态更改Tabhost的Tab的背景图标,用到Ratingbar控件)
- ionic android下tab位置问题
- ionic3 tab实现自定义图片替换字体图标
- ionic中tab切换注意事项
- ionic1 ion-tabs select
- Menu+MultiView 实现Tab(不使用图片)
- Ionic入门七:ionic tab(选项卡)
- ionic实现可滑动的tab选项卡切换效果
- ionic lab新建tab项目如何使用android的tab在底部