<!-- | |
头部 | |
--> | |
<ion-header-bar class="bar-calm"> | |
<h1 class="title">加载更多</h1> | |
</ion-header-bar> | |
<!-- | |
内容 | |
--> | |
<ion-content> | |
<!-- | |
下拉刷新的控件 | |
ion-refresher | |
pulling-text 显示的问题,提示 | |
pulling-icon 图标 | |
on-refresh 刷新时候的回调方法 | |
请求网络,加载数据 | |
--> | |
<ion-refresher pulling-text="刷新..." on-refresh="shauxin()"> | |
</ion-refresher> | |
<ul class="list"> | |
<li class="item" ng-repeat="n in names">{{n}}</li> | |
</ul> | |
</ion-content> | |
<script type="text/javascript"> | |
var mo = angular.module("myApp", ["ionic"]); | |
mo.controller("myCtrl", function($scope,$http) { | |
$scope.names = ["杨过", "胡一刀"]; | |
//刷新的方法 | |
$scope.shauxin = function() { | |
$http.post("data/data1.json").then(function(req){ | |
//接收数据 | |
var newNames = req.data; | |
for(var i = 0;i<newNames.length;i++){ | |
names.push(newNames[i].name); | |
} | |
//发送广播 | |
$scope.$broadcast('scroll.refreshComplete'); | |
},function(req){ | |
console.log("shibai---") | |
}).finally(function(){ | |
console.log("finally---") | |
}); | |
} | |
}) | |
</script> |
ionic
最新推荐文章于 2025-02-17 11:30:44 发布