路由和侧边栏结合使用
来源:互联网 发布:淘宝直通车有用么 编辑:程序博客网 时间:2024/06/07 05:19
在学习ionic中,我们会学习到ionic的路由效果,同时由路由衍生的还有别的页面,比如侧边栏的出现,这个时候我们就应该把这两个东西结合起来,
源代码如下:
<!DOCTYPE html><html ng-app="myApp"><head> <meta charset="UTF-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <link href="https://cdn.bootcss.com/ionic/1.3.2/css/ionic.css" rel="stylesheet"> <script src="https://cdn.bootcss.com/ionic/1.3.2/js/ionic.bundle.min.js"></script> <title>路由-标签切换</title> <script type="text/javascript"> var app = angular.module("myApp", ["ionic"]); app.config(function ($stateProvider, $urlRouterProvider) { $stateProvider.state("home", { url: "/home", views: { "views_home": { templateUrl: "home.html" } } }).state("cart", { url: "/cart", views: { "views-cart": { templateUrl: "cart.html" } } }).state("mine", { url: "/mine", views: { "views-mine": { templateUrl: "mine.html" } } }); }); app.controller("myCtrl", function ($scope, $ionicSideMenuDelegate) { $scope.toggleLeft = function () { $ionicSideMenuDelegate.toggleLeft(); }; }); </script></head><body ng-controller="myCtrl"><ion-side-menus> <!-- 中间内容 --> <ion-side-menu-content > <ion-nav-view name="views_home"></ion-nav-view> </ion-side-menu-content> <!-- 左侧菜单 --> <ion-side-menu side="left"> <ion-header-bar class="bar-positive"> <h1 class="title">左侧</h1> <button class="button button-icon ion-ios-arrow-left" ng-click="toggleLeft()"></button> </ion-header-bar> <ion-content class="has-header"> 这是“侧边栏”页面HTML内容 </ion-content> </ion-side-menu> <!-- 右侧菜单 --></ion-side-menus><ion-tabs class="tabs-positive tabs-icon-top"> <ion-tab title="首页" icon-on="ion-ios-filing" icon-off="ion-ios-filing-outline" ui-sref="home"> </ion-tab> <ion-tab title="购物车" icon-on="ion-ios-cart" icon-off="ion-ios-cart-outline" ui-sref="cart"> <ion-nav-view name="views-cart"></ion-nav-view> </ion-tab> <ion-tab title="我的" icon-on="ion-ios-person" icon-off="ion-ios-person-outline" ui-sref="mine"> <ion-nav-view name="views-mine"></ion-nav-view> </ion-tab></ion-tabs><script id="home.html" type="text/ng-template"> <ion-header-bar class="bar-positive"> <button class="button button-clear" ng-click="toggleLeft()">左按钮</button> <h1 class="title">首页</h1> </ion-header-bar> <ion-content class="has-header"> 这是“首页”页面HTML内容 </ion-content></script><script id="cart.html" type="text/ng-template"> <ion-header-bar class="bar-positive"> <h1 class="title">购物车</h1> <button class="button button-clear">右按钮</button> </ion-header-bar> <ion-content class="has-header"> 这是“购物车”页面HTML内容 </ion-content></script><script id="mine.html" type="text/ng-template"> <ion-header-bar class="bar-positive"> <h1 class="title">我的</h1> <button class="button button-icon ion-ios-more"></button> </ion-header-bar> <ion-content class="has-header"> 这是“我的”页面HTML内容 </ion-content></script></body></html>
阅读全文
1 0
- 路由和侧边栏结合使用
- 路由侧边栏
- 侧边栏使用
- 使用JavaScript和CSS实现异步移动侧边栏
- 使用SlidingMenu和DrawerLayout分别实现左右侧边栏
- Fragment使用—侧边栏
- 侧边栏 MMDrawerController使用教程
- 使用slidingmenu实现侧边栏
- Ionic基础——侧边栏ion-side-menus 以及ion-tap结合侧边栏详解
- 3d动画结合路由跳转使用
- 使用UIScreenEdgePanGestureRecognizer写iOS7侧边栏
- 使用UIScreenEdgePanGestureRecognizer写iOS7侧边栏
- MMDrawerController抽屉侧边栏使用范例代码
- 一个方便使用的轻量级侧边栏
- 使用Iframe标签创建侧边栏
- SectionIndexer解析与使用 联系人侧边栏
- SlidingMenu (侧边栏)使用步骤
- 恢复Ubuntu的标题栏和侧边栏
- 1、找到数组里两个数字之和为某个值
- Effective C++ tips day1
- Hadoop笔记
- group 求阶(BSGS 欧拉定理)
- 虹膜识别 Iris_Osiris_v4.1(支持OpenCV3.3/2.4.13;win/linux)
- 路由和侧边栏结合使用
- 使用 sudo nautilus 进入ubuntu 文件管理器。可以随意复制,删除,粘贴,无权限限制
- 远程连接ubuntu mysql出现2003错误 cant connect to mysql
- 隐马尔可夫模型hidden Markov model
- 单例模式(Singleton)的创建
- Codeforces 279B Books(dp大法好)
- 2017不一样的大数据
- Python3与Python2版本的一点区别
- 新闻类缓存的SqlDao