ionic刷新和加载

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<link rel="stylesheet" href="../lib/css/ionic.css">
<script src="../lib/js/ionic.bundle.min.js"></script>

<script>
var myapp=angular.module('testApp', ['ionic'])
.controller('MyController', function($scope, $http) {
$scope.items = [{"title":"01","desc":"2016秋季爆款","imgsrc":"img/TB1_50x50.jpg"},
{"title":"02","desc":"2016秋季爆款","imgsrc":"img/TB2_50x50.jpg"},
{"title":"03","desc":"2016秋季爆款","imgsrc":"img/TB3_50x50.jpg"},
{"title":"04","desc":"2016秋季爆款","imgsrc":"img/TB4_50x50.jpg"},
{"title":"05","desc":"2016秋季爆款","imgsrc":"img/TB1_50x50.jpg"},
{"title":"06","desc":"2016秋季爆款","imgsrc":"img/TB4_50x50.jpg"},
{"title":"06","desc":"2016秋季爆款","imgsrc":"img/TB4_50x50.jpg"},
{"title":"06","desc":"2016秋季爆款","imgsrc":"img/TB4_50x50.jpg"},
{"title":"06","desc":"2016秋季爆款","imgsrc":"img/TB4_50x50.jpg"},
{"title":"06","desc":"2016秋季爆款","imgsrc":"img/TB4_50x50.jpg"},
{"title":"06","desc":"2016秋季爆款","imgsrc":"img/TB4_50x50.jpg"}];
$scope.doRefresh = function() {
$http.get('../items.json')
.success(function(newItems) {
$scope.items = newItems;
})
.finally(function() {
// 停止广播ion-refresher
$scope.$broadcast('scroll.refreshComplete');
});
};
});
</script>

</head>
<body ng-app="testApp">
<ion-header-bar align-title="center" class="bar-positive">
<div class="buttons">
<button class="button" ng-click="doSomething()">左侧按钮</button>
</div>
<h1 class="title">Title!</h1>
<div class="buttons">
<button class="button">右侧按钮</button>
</div>
</ion-header-bar>

<ion-content ng-controller="MyController">
<ion-refresher
pulling-text="下拉刷新..."
on-refresh="doRefresh()">
</ion-refresher>
<ion-list>
<ion-item ng-repeat="item in items">{{item.desc}}</ion-item>
</ion-list>
</ion-content>


<ion-footer-bar align-title="center" class="bar-assertive">
<div class="buttons">
<button class="button">左侧按钮</button>
</div>
<h1 class="title">Title!</h1>
<div class="buttons" ng-click="doSomething()">
<button class="button">右侧按钮</button>
</div>
</ion-footer-bar>

</body>
</html>

//重要点:导包和items.json

转载于:https://www.cnblogs.com/wsq110/p/7683717.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值