How do i add items to pull to refresh?

Hi guys,

I would like to add items to my pull to refresh from a server or web link. How would i do that? if someone could help me out or point me in the right direction i would be appreciate it.

Here’s my code:

HTML:

<ion-header-bar class="bar-positive">
  <h1 class="title">Pull To Refresh</h1>
</ion-header-bar>
<ion-view view-title="Announcements">
<ion-content>
  <ion-refresher on-refresh="doRefresh()">
                 
  </ion-refresher>
  <ion-list>
    <ion-item ng-repeat="item in items">{{item}}</ion-item>
  </ion-list>
</ion-content>
</ion-view>

javascript:

angular.module('ionicApp', ['ionic'])
.controller('MyCtrl', function($scope, $http) {
  $scope.items = [1,2,3];
  $scope.doRefresh = function() {
    $http.get('/new-items')
     .success(function(newItems) {
       $scope.items = newItems;
     })
     .finally(function() {
       // Stop the ion-refresher from spinning
       $scope.$broadcast('scroll.refreshComplete');
     });
  };
});

I’d suggest these two posts:

http://blog.ionic.io/pull-to-refresh-directive/

Should help you a lot. :smile:

And if you even want a video: