小编Far*_*war的帖子

离子框架无限滚动与http获取数据

我刚刚开始使用离子框架(辉煌),我是棱角分明的新手.我有一个Web服务正在运行,应用程序应该加载数据.我已经设法检索数据,放,wordpress rest api正在以页面的形式发送数据,我不知道如何通过选项卡上的无限滚动实现,这是我的html标记:

<ion-view title="All Wallpapers">
  <ion-content ng-controller="MyCtrl">
    <div class="row" >
    <div ng-controller="PostsController" >
        <div ng-repeat="post in posts">
            <div class="col col-50">
                    <div class="list card">
                          <div class="item item-image">
                            <img ng-src="{{post.thumbnail}}"></>
                          </div>
                          <a class="item item-icon-left assertive" href="#">
                            <i class="icon ion-android-image"></i>
                            {{post.thumbnail_images.full.width}} x {{post.thumbnail_images.full.height}}
                          </a>
                    </div>
            </div>
    </div>
  </div>
  </div>
     <ion-infinite-scroll ng-if="!noMoreItemsAvailable" on-infinite="loadMore()" distance="1%"></ion-infinite-scroll>
 </ion-content>
</ion-view>
Run Code Online (Sandbox Code Playgroud)

在我的apps.js我有:

wallweight.controller('PostsController', function($scope, $http) {
    $scope.page = 1;

    var url='http://wallweight.com/api/get_recent_posts?page';
    $http.get(url).
    success(function(data, status, headers, config) {

        $scope.posts = data.posts;
        console.log(data);
    }
).


    error(function(data, status, headers, config) { …
Run Code Online (Sandbox Code Playgroud)

javascript wordpress jquery angularjs ionic-framework

2
推荐指数
1
解决办法
5794
查看次数