Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49103

Ionic Pull To Refresh HELP

$
0
0

@Ckpk wrote:

Please help master,

Tried to create pull to refresh action using ionic but seem it does not work, the icon just keep show and nothing happen.

Anyone can help me?

Here is the code.

lists.html

<ion-header-bar align-title="center" class="bar-stable">
  <h1 class="title">Latest Items</h1>
  <button class="button button-clear button-positive" ui-sref="addlist">New</button>
</ion-header-bar>
<ion-view title="Terbaru">
  <ion-content>
      <ion-refresher on-refresh="doRefresh()">
        pulling-text="Pull to refresh..."
      </ion-refresher>
      <label class="item item-input">
        <i class="icon ion-search placeholder-icon"></i>
        <input type="text" name="dash.search" value="" placeholder="Search">
      </label>
      <div class="list card" ng-repeat="x in data" type="item-text-wrap" href="#/tab/chat/{{x.id}}">
          <div class="item item-avatar">
            <img data-ng-src="data:image/png;base64,{{x.photopath}}">
            <h2>{{x.title}}</h2>
            <p>{{x.tgl}}</p>
          </div>

          <div class="item item-body">
            <img class="full-image" data-ng-src="data:image/jpeg;base64,{{x.imagepath}}">
            <p>
              {{x.descr}}
            </p>
            <p>
              <a href="#" class="subdued">1 Like</a>
              <a href="#" class="subdued right">5 Comments</a>
            </p>
          </div>
        </div>
      </ion-content>
</ion-view>

controller.js

angular.module('ionicApp.controllers', [])

.controller('AddListCategoryCtrl', function($scope, $http) {
    var xhr = $http({
      method: 'post',
      url: 'http://www.mywebsite.com/api/listCat.php'
    });
    xhr.success(function(data){
      $scope.data = data.data;
    });
    $scope.doRefresh = function(){
      $http.get('http://www.mywebsite.com/api/lists.php')
      .success(function(data){
        $scope.data=data.data;
        console.log($scope.data);
      })
      .finally(function(){
        $scope.$broadcast('scroll.refreshComplete');
        $scope.$apply()
      });
    }
});

Posts: 3

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 49103

Trending Articles