Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save four2theizz0/22c137f5e277ae16e185 to your computer and use it in GitHub Desktop.
Save four2theizz0/22c137f5e277ae16e185 to your computer and use it in GitHub Desktop.
A Pen by Justin Noel.
<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>Ionic Template</title>
<link href="http://code.ionicframework.com/nightly/css/ionic.min.css" rel="stylesheet">
<script src="http://code.ionicframework.com/nightly/js/ionic.bundle.min.js"></script>
</head>
<body ng-controller="MyCtrl">
<ion-header-bar title="myTitle"></ion-header-bar>
<ion-content has-header="true" padding="false">
<ion-refresher
pulling-text="Pull to refresh..."
on-refresh="doRefresh()"
refreshing-icon="ion-loading-c"
>
</ion-refresher>
<ion-list>
<ion-item ng-repeat="item in items">{{item}}</ion-item>
</ion-list>
</ion-content>
</body>
</html>

Ionic - Pull To Refresh Nightly 03/11/2014

Using the Pull To Refresh feature for release AFTER 0.9.26

A Pen by Justin Noel on CodePen.

License.

angular.module('ionicApp', ['ionic'])
.controller('MyCtrl', function($scope, $timeout) {
$scope.myTitle = 'Template';
$scope.items = ['Item 1', 'Item 2', 'Item 3'];
$scope.doRefresh = function() {
console.log('Refreshing!');
$timeout( function() {
$scope.items.push('New Item ' + Math.floor(Math.random() * 1000) + 4);
$scope.items.push('New Item ' + Math.floor(Math.random() * 1000) + 4);
$scope.items.push('New Item ' + Math.floor(Math.random() * 1000) + 4);
$scope.items.push('New Item ' + Math.floor(Math.random() * 1000) + 4);
//Stop the ion-refresher from spinning
$scope.$broadcast('scroll.refreshComplete');
}, 1000);
};
});
body {
cursor: url('http://ionicframework.com/img/finger.png'), auto;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment