小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

ionic教程5

 看見就非常 2015-04-24

Ionic提供了非常簡單的指令來實現(xiàn)下拉刷新。首先,我們需要在列表前加一個標簽

1
2
3
4
5
6
7
8
9
10
11
12
13
<body ng-app="ionicApp">
  <ion-header-bar class="bar-energized">
    <h1 class="title">Pull to Refresh!</h1>
  </ion-header-bar>
  <ion-content ng-controller="TodosCtrl">
    <ion-refresher pulling-text="Pull to refresh" on-refresh="doRefresh()">
    </ion-refresher>
    <ion-list>
      <ion-item ng-repeat="todo in todos">{{todo.name}}</ion-item>
    </ion-list>    
  </ion-content>
</body>

我們可以定義下拉刷新時顯示的字體,以及對應的操作,這里是調用doRefresh();

下面我們看一下js里面怎么控制

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
var app = angular.module('ionicApp', ['ionic'])
app.controller('TodosCtrl', function($scope) {
  $scope.todos =  [
    {name: "Do the dishes"},
    {name: "Take out the trash"}
  ]
  
  $scope.doRefresh = function() {
    $scope.todos.unshift({name: 'Incoming todo ' + Date.now()})
    $scope.$broadcast('scroll.refreshComplete');
    $scope.$apply()
  };
  
})

這里我們實現(xiàn)上面標簽里的doRefresh來更新數(shù)據(jù),注意,在數(shù)據(jù)更新完成后要$broadcast廣播一個scroll.refreshComplete的事件,這個事件是讓ion-refresher知道刷新已經(jīng)完成,可以隱藏自己了。

    本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內容均由用戶發(fā)布,不代表本站觀點。請注意甄別內容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權內容,請點擊一鍵舉報。
    轉藏 分享 獻花(0

    0條評論

    發(fā)表

    請遵守用戶 評論公約

    類似文章 更多