mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-06 22:29:44 +08:00
138 lines
4.1 KiB
HTML
138 lines
4.1 KiB
HTML
<html ng-app="tabsTest">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Tab Bars</title>
|
|
|
|
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
<link rel="stylesheet" href="../../../../dist/css/ionic.css">
|
|
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular.min.js"></script>
|
|
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular-touch.js"></script>
|
|
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0-rc.2/angular-animate.js"></script>
|
|
<style>
|
|
.fade-out > .ng-enter,
|
|
.fade-out > .ng-leave,
|
|
.fade-out > .ng-move {
|
|
-webkit-transition: 0.2s linear all;
|
|
transition: 0.4s ease-out all;
|
|
position:relative;
|
|
}
|
|
|
|
.fade-out > .ng-enter {
|
|
left:-10px;
|
|
opacity:0;
|
|
}
|
|
.fade-out > .ng-enter.ng-enter-active {
|
|
left:0;
|
|
opacity:1;
|
|
}
|
|
|
|
.fade-out > .ng-leave {
|
|
left:0;
|
|
opacity:1;
|
|
}
|
|
.fade-out > .ng-leave.ng-leave-active {
|
|
left:-10px;
|
|
opacity:0;
|
|
}
|
|
|
|
.fade-out > .ng-move {
|
|
opacity:0.5;
|
|
}
|
|
.fade-out > .ng-move.ng-move-active {
|
|
opacity:1;
|
|
}
|
|
|
|
.completed {
|
|
text-decoration: line-through;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<tab-controller>
|
|
|
|
<div title="Home" icon-on="icon-ios7-filing" icon-off="icon-ios7-filing-outline" class="tab-content" ng-controller="HomeCtrl">
|
|
<header class="bar bar-header bar-secondary">
|
|
<h1 class="title">Tasks</h1>
|
|
<button class="button button-clear button-primary" ng-click="isEditingItems = !isEditingItems">Edit</button>
|
|
</header>
|
|
<content has-header="true" has-tabs="true">
|
|
<list is-editing="isEditingItems" animation="fade-out" delete-icon="icon-minus-circled" reorder-icon="icon-navicon">
|
|
<list-item ng-repeat="item in items"
|
|
item="item"
|
|
buttons="item.buttons"
|
|
can-delete="true"
|
|
can-reorder="true"
|
|
can-swipe="true"
|
|
on-delete="deleteItem(item)"
|
|
ng-class="{completed: item.isCompleted}"
|
|
>
|
|
{{item.title}}
|
|
<i class="{{item.icon}}"></i>
|
|
</list-item>
|
|
</list>
|
|
</content>
|
|
</div>
|
|
|
|
<div title="About" icon-on="icon-ios7-clock" icon-off="icon-ios7-clock-outline" class="tab-content">
|
|
<header class="bar bar-header bar-secondary">
|
|
<h1 class="title">Deadlines</h1>
|
|
</header>
|
|
<content has-header="true" has-tabs="true">
|
|
<h1>Deadlines</h1>
|
|
</content>
|
|
</div>
|
|
|
|
<div title="Settings" icon-on="icon-ios7-gear" icon-off="icon-ios7-gear-outline" class="tab-content">
|
|
<header class="bar bar-header bar-secondary">
|
|
<h1 class="title">Settings</h1>
|
|
</header>
|
|
<content has-header="true" has-tabs="true">
|
|
<h1>Settings</h1>
|
|
</content>
|
|
</div>
|
|
</tab-controller>
|
|
|
|
<script src="../../../../dist/js/ionic.js"></script>
|
|
<script src="../../../../dist/js/ionic-angular.js"></script>
|
|
<script>
|
|
angular.module('tabsTest', ['ionic.ui'])
|
|
|
|
.controller('HomeCtrl', function($scope) {
|
|
$scope.items = [];
|
|
|
|
var removeItem = function(item, button) {
|
|
console.log('Removing item', item);
|
|
// Remove ourselves
|
|
$scope.items.splice($scope.items.indexOf(item), 1);
|
|
};
|
|
var completeItem = function(item, button) {
|
|
// Remove ourselves
|
|
console.log('Completing item', item);
|
|
item.isCompleted = true;
|
|
};
|
|
|
|
$scope.removeItem = function(item) {
|
|
removeItem(item);
|
|
};
|
|
|
|
for(var i = 0; i < 30; i++) {
|
|
$scope.items.push({
|
|
title: 'Task ' + (i + 1),
|
|
buttons: [{
|
|
text: 'Done',
|
|
type: 'button-success',
|
|
onButtonClicked: completeItem,
|
|
}, {
|
|
text: 'Delete',
|
|
type: 'button-danger',
|
|
onButtonClicked: removeItem,
|
|
}]
|
|
});
|
|
}
|
|
|
|
})
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|