<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" type="text/css" href="js/ionic.css"/>
<script src="js/ionic.bundle.min.js" type="text/javascript" charset="utf-8"></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>
-----------第二种---------
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>ionic练习1</title>
<!--
框架
1.下载类库,。。。。。
2.导入工程
3.使用
头部
ion-header-bar
内容
ion-content
脚
ion-footer-bar
-->
<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="myCtrl">
<!--
头部
如果要修改样式,使用class属性
ionic.css里面已经定义好了一些属性。
标题居中
-->
<ion-header-bar class="bar-positive">
<!--
标题左侧加按钮
-->
<input type="button" value="返回" class="button" />
<div class="title" align-title="center">
HelloIonic!
</div>
<input type="button" value="刷新" class="button" />
</ion-header-bar>
<!--
中间内容
-->
<ion-content>
<ion-refresher pulling-text="下拉刷新" on-refresh="doRefresh()"></ion-refresher>
<ul class="list">
<li class="item">手机</li>
<li class="item">手机</li>
<li class="item">手机</li>
</ul>
</ion-content>
<!--
脚
-->
<ion-footer-bar class="bar bar-positive">
<span class="title" align-title="center">
我是底部
</span>
</ion-footer-bar>
<script type="text/javascript">
var mo = angular.module("myApp", ["ionic"]); //依赖注入,:加入ionic对象
mo.controller("myCtrl", function($scope) {
//下拉刷新的方法
$scope.doRefresh = function(){
console.log("开始刷新....")
//结束刷新,让刷新的条目回去
//发送广播,结束刷新
// $scope.$broadcast('scroll.refreshComplete');
}
});
</script>
</body>
</html>
1203

被折叠的 条评论
为什么被折叠?



