mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-08 15:51:16 +08:00
160 lines
4.5 KiB
HTML
160 lines
4.5 KiB
HTML
<html ng-app="navTest">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>List</title>
|
|
|
|
<!-- Sets initial viewport load and disables zooming -->
|
|
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
|
|
<link rel="stylesheet" href="../../../../dist/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>
|
|
.my-repeat-animation > .ng-enter,
|
|
.my-repeat-animation > .ng-leave,
|
|
.my-repeat-animation > .ng-move {
|
|
-webkit-transition: 0.2s linear all;
|
|
transition: 0.2s linear all;
|
|
position:relative;
|
|
}
|
|
|
|
.my-repeat-animation > .ng-enter {
|
|
left:-10px;
|
|
opacity:0;
|
|
}
|
|
.my-repeat-animation > .ng-enter.ng-enter-active {
|
|
left:0;
|
|
opacity:1;
|
|
}
|
|
|
|
.my-repeat-animation > .ng-leave {
|
|
left:0;
|
|
opacity:1;
|
|
}
|
|
.my-repeat-animation > .ng-leave.ng-leave-active {
|
|
left:-10px;
|
|
opacity:0;
|
|
}
|
|
|
|
.my-repeat-animation > .ng-move {
|
|
opacity:0.5;
|
|
}
|
|
.my-repeat-animation > .ng-move.ng-move-active {
|
|
opacity:1;
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
<body>
|
|
|
|
<content has-header="true" ng-controller="TestCtrl" class="reveal-animation">
|
|
<list is-editing="isEditingItems">
|
|
<li href="#" class="list-item">
|
|
<div class="list-item-edit">
|
|
<button class="button button-icon"><i class="icon-minus-circled"></i></button>
|
|
</div>
|
|
<div class="list-item-content">
|
|
Item 1
|
|
<i class="icon-arrow-right"></i>
|
|
</div>
|
|
<div class="list-item-buttons">
|
|
<button class="button button-danger">Delete</button>
|
|
</div>
|
|
</li>
|
|
<li href="#" class="list-item">
|
|
<div class="list-item-content">
|
|
Item 2
|
|
<i class="icon-arrow-right"></i>
|
|
</div>
|
|
<div class="list-item-buttons">
|
|
<button class="button button-danger">Delete</button>
|
|
</div>
|
|
</li>
|
|
<li href="#" class="list-item">
|
|
<div class="list-item-content">
|
|
Item 3
|
|
<i class="icon-arrow-right"></i>
|
|
</div>
|
|
<div class="list-item-buttons">
|
|
<button class="button button-danger">Delete</button>
|
|
</div>
|
|
</li>
|
|
</list>
|
|
<list items="items" is-editing="isEditingItems" animation="my-repeat-animation" delete-icon="icon-minus-circled">
|
|
</list>
|
|
<button ng-click="edit()" class="button button-success">Edit</button>
|
|
</content>
|
|
|
|
<script src="../../../../dist/ionic.js"></script>
|
|
<script src="../../../../dist/ionic-angular.js"></script>
|
|
<script>
|
|
angular.module('navTest', ['ionic.ui.list', 'ngAnimate'])
|
|
|
|
.controller('TestCtrl', function($scope) {
|
|
var removeItem = function(item) {
|
|
// Remove ourselves
|
|
$scope.items.splice($scope.items.indexOf(item), 1);
|
|
};
|
|
|
|
$scope.items = [
|
|
{
|
|
text: 'Item 1',
|
|
canDelete: true,
|
|
canSwipe: true,
|
|
icon: 'icon-chevron-right',
|
|
hide: false,
|
|
deleteItem: removeItem,
|
|
buttons: [{
|
|
text: 'Kill',
|
|
type: 'button-danger',
|
|
buttonClicked: removeItem,
|
|
}]
|
|
},
|
|
{
|
|
text: 'Item 2',
|
|
canDelete: true,
|
|
canSwipe: true,
|
|
icon: 'icon-chevron-right',
|
|
deleteItem: removeItem,
|
|
buttons: [{
|
|
text: 'Kill',
|
|
type: 'button-danger',
|
|
buttonClicked: removeItem,
|
|
}]
|
|
},
|
|
{
|
|
text: 'Item 3',
|
|
canDelete: true,
|
|
canSwipe: true,
|
|
icon: 'icon-chevron-right',
|
|
deleteItem: removeItem,
|
|
buttons: [{
|
|
text: 'Kill',
|
|
type: 'button-danger',
|
|
buttonClicked: removeItem,
|
|
}]
|
|
},
|
|
{
|
|
text: 'Item 4',
|
|
canDelete: true,
|
|
canSwipe: true,
|
|
icon: 'icon-chevron-right',
|
|
deleteItem: removeItem,
|
|
buttons: [{
|
|
text: 'Kill',
|
|
type: 'button-danger',
|
|
buttonClicked: removeItem,
|
|
}]
|
|
}
|
|
];
|
|
$scope.edit = function() {
|
|
$scope.isEditingItems = !$scope.isEditingItems;
|
|
}
|
|
});
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|
|
|