不多说。直接上代码
这是html部分 <ion-refresher pulling-text="正在刷新" on-refresh="doRefresh()"> </ion-refresher> <div class="home-slide"> <ion-slide-box does-continue="true" auto-play="true" slide-interval="2000"> <ion-slide ng-repeat="bannerSrc in bannerSrcList" does-continue="true" slide-interval="true"> <a ng-href="{{bannerSrc.url}}"> <img ng-src="{{bannerSrc.imgSrc}}" alt="{{bannerSrc.name}}"> </a> </ion-slide> </ion-slide-box> </div> 这是controller .controller("homeCtrl", function ($scope, $http, $timeout, $ionicSlideBoxDelegate, handleArray, randomNumber) { var tabHomeUrl = define.mainUrl + "/tab/tab-home.json";
$http.get(tabHomeUrl,{type:0}) .success(function (data) { //console.log(angular.toJson(data, true)); //轮播数据 $scope.bannerSrcList = data.bannerSrcList; }); $timeout(function () { $ionicSlideBoxDelegate.$getByHandle('slideimgs').update(); $ionicSlideBoxDelegate.$getByHandle('slideimgs').loop(true); }, 100); //刷新处理 $scope.doRefresh = function () { $http.get(tabHomeUrl,{type:1}) .success(function (newData) { /* * 此处有问题 */ $scope.bannerSrcList = newData.bannerSrcList; console.log("刷新数据成功") }).finally(function () { $scope.$broadcast('scroll.refreshComplete'); }); };
})
|