mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
list updates
This commit is contained in:
134
js/ext/angular/test/pullToRefresh.html
Normal file
134
js/ext/angular/test/pullToRefresh.html
Normal file
@@ -0,0 +1,134 @@
|
||||
<html ng-app="navTest">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Pull To Refresh</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/css/ionic.css">
|
||||
<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;
|
||||
z-index: 10;
|
||||
}
|
||||
.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 ng-controller="TestCtrl">
|
||||
|
||||
<pane>
|
||||
|
||||
<header class="bar bar-header bar-positive">
|
||||
<div class="buttons">
|
||||
<button ng-click="toggleDelete()" class="button button-clear">{{ editBtnText }}</button>
|
||||
</div>
|
||||
<h1 class="title">Pull To Refresh</h1>
|
||||
</header>
|
||||
|
||||
<content has-header="true"
|
||||
on-refresh-holding="refreshHolding()"
|
||||
on-refresh-opening="refreshOpening(ratio)"
|
||||
on-refresh="refreshItems()"
|
||||
refresh-complete="refreshComplete">
|
||||
|
||||
<list show-delete="isDeletingItems" animation="my-repeat-animation">
|
||||
|
||||
<refresher></refresher>
|
||||
|
||||
<item ng-repeat="item in items"
|
||||
item="item"
|
||||
on-delete="deleteListItem(item)">
|
||||
Item: {{ item.text }}
|
||||
</item>
|
||||
|
||||
</list>
|
||||
|
||||
</content>
|
||||
|
||||
</pane>
|
||||
|
||||
<script src="../../../../dist/js/ionic.js"></script>
|
||||
<script src="../../../../dist/js/angular/angular.js"></script>
|
||||
<script src="../../../../dist/js/angular/angular-animate.js"></script>
|
||||
<script src="../../../../dist/js/angular/angular-route.js"></script>
|
||||
<script src="../../../../dist/js/angular/angular-touch.js"></script>
|
||||
<script src="../../../../dist/js/angular/angular-sanitize.js"></script>
|
||||
<script src="../../../../dist/js/ionic-angular.js"></script>
|
||||
<script>
|
||||
angular.module('navTest', ['ionic.ui.list', 'ionic.ui.content'])
|
||||
|
||||
.controller('TestCtrl', function($scope, $timeout) {
|
||||
|
||||
// Build Mock Data
|
||||
function buildMockData() {
|
||||
$scope.items = [];
|
||||
for(var i = 0; i < 20; i++) {
|
||||
$scope.items.push({
|
||||
text: i
|
||||
});
|
||||
}
|
||||
}
|
||||
buildMockData();
|
||||
|
||||
// List Methods/Properties
|
||||
$scope.refreshHolding = function() {
|
||||
console.log('HOLDING FOR REFRESH');
|
||||
};
|
||||
$scope.refreshOpening = function(amt) {
|
||||
console.log('REFRESH OPENING', amt);
|
||||
$scope.refreshRatio.ratio = amt;
|
||||
$scope.$apply();
|
||||
};
|
||||
$scope.refreshItems = function() {
|
||||
console.log("REFRESHING");
|
||||
$timeout(function() {
|
||||
buildMockData();
|
||||
$scope.refreshComplete();
|
||||
}, 1500);
|
||||
};
|
||||
$scope.refreshRatio = { ratio: 0 };
|
||||
|
||||
$scope.editBtnText = 'Edit';
|
||||
$scope.toggleDelete = function() {
|
||||
$scope.isDeletingItems = !$scope.isDeletingItems;
|
||||
$scope.editBtnText = ($scope.isDeletingItems ? 'Done' : 'Edit');
|
||||
};
|
||||
$scope.deleteListItem = function(item) {
|
||||
$scope.items.splice($scope.items.indexOf(item), 1);
|
||||
};
|
||||
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user