<!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