AngularJS:拉动刷新

时间:2014-08-28 17:23:20

标签: javascript angularjs pull-to-refresh

我试图使用mgcrea的Angular.js拉动刷新库,但我无法将其拉下来并开火。我可以看到它在div上方开始的虚线,但它根本不会拉下来。我在Chrome控制台或Logcat中没有收到任何错误。

index.html :此处包含pull-to-refresh.js和css文件。

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Mobile Dashboard</title>
        <meta name="viewport" content="width=device-width, user-scalable=no">

        <link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Open+Sans:400,600,700|Droid+Sans:400,700" />
        <link rel="stylesheet" href="assets/css/mobile-angular-ui-base.css" />
        <link rel="stylesheet" type="text/css" href="assets/fonts/icons.css" />
        <link rel="stylesheet" type="text/css" href="assets/css/angular-pull-to-refresh.css" />

        <script src="assets/js/libs/angular.min.js"></script>
        <script src="assets/js/libs/angular-route.min.js"></script>
        <script src="assets/js/libs/angular-touch.min.js"></script>
        <script src="assets/js/libs/angular-sanitize.min.js"></script>
        <script src="assets/js/libs/mobile-angular-ui.min.js"></script>

        <script src="assets/js/libs/angular-pull-to-refresh.js"></script>

        <script src="assets/js/app.js"></script>
    </head>
    <body ontouchstart="" ng-app="mobile" class="blue">
        <div class="app">
            <div class="navbar navbar-app navbar-primary navbar-absolute-top">
                <div class="navbar-brand navbar-brand-left">
                    <div class="logo">
                        <img src="assets/img/logo_small.png" width="50px" height="50px" />
                    </div>
                </div>
            </div>
            <div class="app-body">
                <ng-view class="app-content"></ng-view>
            </div>
        </div>
    </body>
</html>

miners.html :我已尝试在顶级div和ul中放置pull-to-refresh,但没有骰子。

<div class="scrollable">

      <ul id="miners" class="list-group list-group-table" pull-to-refresh="refresh()">
          <li ng-repeat="miner in miners" class="list-group-item">
              [foo code]
          </li>
          <li class="list-group-item">
            [more foo code]
          </li>
      </ul>

</div>

相关的css部分

.scrollable {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  overflow: auto;
  -webkit-backface-visibility: none;
  -webkit-overflow-scrolling: auto;
}

此时,我完全被困住了。有没有人对我可能错过的内容有任何想法?

1 个答案:

答案 0 :(得分:6)

不幸的是,我相信mgcrea的角度拉动刷新项目已被放弃。即使他的github自述文件中的示例也不再有效,并且有几张票据表明其他人也没有使用它。