ionic的组件 ion-tabs的一个实例
2015-03-09 20:12
267 查看
app.html
app.js
效果:
参考链接:http://www.haomou.net/2014/08/11/2014_ionic_api
部分相关js下载地址:http://code.ionicframework.com
<!DOCTYPE html> <html ng-app="ionicApp"> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width"> <title>Inline Tabs</title> <link href="css/ionic.min.css" rel="stylesheet"> <script src="js/ionic.bundle.min.js"></script> <script src="js/app.js"></script> </head> <body ng-controller="RootCtrl"> <ion-tabs class="tabs-icon-only tabs-positive"> <ion-tab title="Home" icon-on="ion-ios7-filing" icon-off="ion-ios7-filing-outline" ng-controller="HomeCtrl"> <ion-header-bar class="bar-positive"> <button class="button button-clear" ng-click="newTask()">New</button> <h1 class="title">Tasks</h1> </ion-header-bar> <ion-content has-tabs="true" on-refresh="onRefresh()"> <ion-refresher></ion-refresher> <ion-list scroll="false" on-refresh="onRefresh()" s-editing="isEditingItems" animation="fade-out" delete-icon="icon ion-minus-circled"> <ion-item ng-repeat="item in items" item="item" buttons="item.buttons" can-delete="true" can-swipe="true" on-delete="deleteItem(item)" ng-class="{completed: item.isCompleted}"> <i class=""></i> </ion-item> </ion-list> </ion-content> </ion-tab> <ion-tab title="About" icon-on="icon ion-ios7-clock" icon-off="icon ion-ios7-clock-outline"> <header class="bar bar-header bar-positive"> <h1 class="title">Deadlines</h1> </header> <ion-content has-header="true"> <h1>Deadlines</h1> </ion-content> </ion-tab> <ion-tab title="Settings" icon-on="icon ion-ios7-gear" icon-off="icon ion-ios7-gear-outline"> <header class="bar bar-header bar-positive"> <h1 class="title">Settings</h1> </header> <ion-content has-header="true"> <h1>Settings</h1> </ion-content> </ion-tab> </ion-tabs> <script id="newTask.html" type="text/ng-template"> <div id="task-view" class="modal slide-in-up" ng-controller="TaskCtrl"> <header class="bar bar-header bar-secondary"> <h1 class="title">New Task</h1> <button class="button button-clear button-primary" ng-click="close()">Done</button> </header> <ion-content class="padding has-header"> <input type="text" placeholder="I need to do this..."> </ion-content> </div> </script> </body> </html>
app.js
angular.module('ionicApp', [ 'ionic' ]).controller( 'RootCtrl', function($scope) { $scope.onControllerChanged = function(oldController, oldIndex, newController, newIndex) { console.log('Controller changed', oldController, oldIndex, newController, newIndex); console.log(arguments); }; }).controller('HomeCtrl', function($scope, $timeout, $ionicModal, $ionicActionSheet) { $scope.items = []; $ionicModal.fromTemplateUrl('newTask.html', function(modal) { $scope.settingsModal = modal; }); var removeItem = function(item, button) { $ionicActionSheet.show({ buttons : [], destructiveText : 'Delete Task', cancelText : 'Cancel', cancel : function() { return true; }, destructiveButtonClicked : function() { $scope.items.splice($scope.items.indexOf(item), 1); return true; } }); }; var completeItem = function(item, button) { item.isCompleted = true; }; $scope.onReorder = function(el, start, end) { ionic.Utils.arrayMove($scope.items, start, end); }; $scope.onRefresh = function() { console.log('ON REFRESH'); $timeout(function() { $scope.$broadcast('scroll.refreshComplete'); }, 1000); } $scope.removeItem = function(item) { removeItem(item); }; $scope.newTask = function() { $scope.settingsModal.show(); }; // Create the items for (var i = 0; i < 25; i++) { $scope.items.push({ title : 'Task ' + (i + 1), buttons : [ { text : 'Done', type : 'button-success', onButtonClicked : completeItem, }, { text : 'Delete', type : 'button-danger', onButtonClicked : removeItem, } ] }); } }).controller('TaskCtrl', function($scope) { $scope.close = function() { $scope.modal.hide(); } });
效果:
参考链接:http://www.haomou.net/2014/08/11/2014_ionic_api
部分相关js下载地址:http://code.ionicframework.com
相关文章推荐
- ionic组件ion-tabs选项卡切换效果实例
- ionic组件ion-tabs(选项卡)实例
- ionic组件ion-tabs选项卡切换效果实例
- ionic入门教程第九课-开始动手做项目吧!ion-nav-bar、ion-nav-buttons、ion-tabs
- ionic开发中页面跳转隐藏ion-tabs
- ionic入门教程第十课-接着说说ion-slide-box和它的注意事项、slide-tabs
- ionic中 ion-tabs嵌套问题的解决
- ionic框架popover组件<ion-popover-view>的滚动问题
- ion-tabs接口文档:Delegate: $ionicTabsDelegate
- 【ionic+angulajs】ion-tabs访问页面url不记录历史的方法(修改浏览器记录的历史url,改变goback的跳转)
- ionic之时间&日期组件实例
- ASP实例:一个简单的ASP无组件上传类
- Ionic 2 中创建一个照片倾斜浏览组件
- SWT组件的生命周期(续一个简单的SWT程序实例及详解)
- 【ionic App问题总结系列】ionic隐藏底部菜单栏ion-tabs
- Ionic ion-header-bar、bar-subheader、ion-tabs
- 在meteor中如何使用ionic组件tabs,及如何添加使用cordova plugin inappbrower
- java swing最简单实例(2) 往JFrame里面放一个容器或组件
- ionic 隐藏ion-tabs 并解决延迟问题 (tabs)
- ionic入门教程第九课-开始动手做项目吧!ion-nav-bar、ion-nav-buttons、ion-tabs