离子:拉动刷新不起作用

Ionic: Pull to refresh isn't working

这可能是一个非常简单的错误,但我已经坚持了一段时间。如果有人能帮助我,我将不胜感激!!谢谢,我会把代码放在下面。 Http.get 工作正常,因为我已经在一个按钮上进行了测试,就在我粘贴拉动以刷新代码时它停止工作。

代码HTML:

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
    <title>Announcement</title>

    <link href="lib/ionic/css/ionic.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">

    <!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
    <link href="css/ionic.app.css" rel="stylesheet">
    -->

    <!-- ionic/angularjs js -->
    <script src="lib/ionic/js/ionic.bundle.js"></script>

    <!-- cordova script (this will be a 404 during development) -->
    <script src="cordova.js"></script>

    <!-- your app's js -->
    <script src="js/app.js"></script>
    <script src="js/controllers.js"></script>
    <script src="js/services.js"></script>
  </head>
  <body ng-app="Announcement">
    <ion-view view-title="Announcements">
      <ion-pane>
         <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" ng-click="getData()">

            <div class="list card">
              <div class="item item-divider">{{announcement_name}} - {{date}}</div>
              <div class="item item-body">
                <div>
                  {{message}}
                </div>
            </ion-item>
          </ion-list>
        </ion-content>
        </ion-view>
  </body>
</html>

Javascript:

.controller('Controller', function($scope, $http) {
    $scope.items = [1,2,3];
    $scope.doRefresh = function() {
        $http.get("", { params: { "name": "value1", "date": "value2", "message": "value3"} })
            .success(function(data) {
                $scope.announcement_name = data.announcement_name;
                $scope.date = data.date;
                $scope.message = data.message;
            })
            .finally(function() {
           // Stop the ion-refresher from spinning
           $scope.$broadcast('scroll.refreshComplete');
         });
         myApp.error(function(newItems) {
        alert("something went wrong");
      })
      };
    });

这个 Controller 在哪里初始化的?我认为您需要添加以下内容: (例如)

 <ion-content ng-controller="Controller">

您的问题似乎是您的控制器未被调用,因此函数 doRefresh 不存在

如果这不是您的问题,您的意思是:

"it's just when i paste the pull to refresh code it stops working."