<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script src="js/ionic.bundle.min.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="css/ionic.css"/>
</head>
<body ng-app="myApp" ng-controller="myContl">
<ion-header-bar class="bar-positive">
<h2 class="title">下拉刷新</h2>
</ion-header-bar>
<ion-content>
<!--
下拉刷新
ion-refresher
pulling-text 下拉的时候显示的文本
pulling-icon 图标
onRefresh 当刷新的时候调用的方法
-->
<ion-refresher pulling-text="松手刷新..." on-refresh = "doRefresh()">
</ion-refresher>
<!--<ion-refresher pulling-text="松手刷新..." on-refresh = "doRefresh()" pulling-icon="img/arrow-down-c.png">-->
<ul class="list">
<li class="item" ng-repeat="good in goods">{{good.gname}}</li>
</ul>
</ion-content>
<script type="text/javascript">
var mo = angular.module("myApp",["ionic"]);
mo.controller("myContl",function($scope,$http){
//定义数组、也就是model数据
$scope.goods=[{"gname":"秋裤"},{"gname":"羽绒服"}];
$scope.doRefresh = function(){
//请求网络,加载数据
$http.get("data.json").then(function(req){
//取得数据 ,req将数据封装到data属性里面了
var d = req.data;
//将一个集合整个加入另外一个集合contact()
// $scope.goods= $scope.goods.contact(d);
for (var i =0;i<d.length;i++) {
$scope.goods.unshift(d[i]);
}
//结束刷新
$scope.$broadcast("scroll.refreshComplete");
});
}
})
</script>
</body>
</html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script src="js/ionic.bundle.min.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" type="text/css" href="css/ionic.css"/>
</head>
<body ng-app="myApp" ng-controller="myContl">
<ion-header-bar class="bar-positive">
<h2 class="title">下拉刷新</h2>
</ion-header-bar>
<ion-content>
<!--
下拉刷新
ion-refresher
pulling-text 下拉的时候显示的文本
pulling-icon 图标
onRefresh 当刷新的时候调用的方法
-->
<ion-refresher pulling-text="松手刷新..." on-refresh = "doRefresh()">
</ion-refresher>
<!--<ion-refresher pulling-text="松手刷新..." on-refresh = "doRefresh()" pulling-icon="img/arrow-down-c.png">-->
<ul class="list">
<li class="item" ng-repeat="good in goods">{{good.gname}}</li>
</ul>
</ion-content>
<script type="text/javascript">
var mo = angular.module("myApp",["ionic"]);
mo.controller("myContl",function($scope,$http){
//定义数组、也就是model数据
$scope.goods=[{"gname":"秋裤"},{"gname":"羽绒服"}];
$scope.doRefresh = function(){
//请求网络,加载数据
$http.get("data.json").then(function(req){
//取得数据 ,req将数据封装到data属性里面了
var d = req.data;
//将一个集合整个加入另外一个集合contact()
// $scope.goods= $scope.goods.contact(d);
for (var i =0;i<d.length;i++) {
$scope.goods.unshift(d[i]);
}
//结束刷新
$scope.$broadcast("scroll.refreshComplete");
});
}
})
</script>
</body>
</html>