Files
2013-10-09 21:08:12 -05:00

152 lines
4.3 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 href="https://netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.min.css" rel="stylesheet">
<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-sign"></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">
</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) {
$scope.items = [
{
text: 'Item 1',
canDelete: true,
canSwipe: true,
icon: 'icon-chevron-right',
hide: false,
buttons: [{
text: 'Kill',
type: 'button-danger',
buttonClicked: function(item) {
// Remove ourselves
$scope.items.splice($scope.items.indexOf(item), 1);
}
}]
},
{
text: 'Item 2',
canDelete: true,
canSwipe: true,
icon: 'icon-chevron-right',
buttons: [{
text: 'Kill',
type: 'button-danger'
}]
},
{
text: 'Item 3',
canDelete: true,
canSwipe: true,
icon: 'icon-chevron-right',
buttons: [{
text: 'Kill',
type: 'button-danger'
}]
},
{
text: 'Item 4',
canDelete: true,
canSwipe: true,
icon: 'icon-chevron-right',
buttons: [{
text: 'Kill',
type: 'button-danger'
}]
}
];
$scope.edit = function() {
$scope.isEditingItems = !$scope.isEditingItems;
}
});
</script>
</body>
</html>