AngularJS 无限滚动加载数据控件 ngInfiniteScroll

AngularJS无限滚动加载
本文介绍如何使用AngularJS的ng-infinite-scroll.js组件实现无限滚动加载功能。通过简单的示例代码展示如何配置和使用该组件,以便在用户滚动到页面底部时自动加载更多数据。
[color=red][size=x-large]在开发中我们可能会遇到滚动鼠标到浏览器底部实现数据的加载,js和jquery实现都不复杂都是既然AngularJS提供现成的我们怎么不用昵。[/size][/color]
[size=x-large]ng-infinite-scroll.js这个组件则可以实现:[/size]
[size=x-large]ng-infinite-scroll.js:下载地址:http://sroze.github.io/ngInfiniteScroll/[/size]
[color=olive][size=x-large]使用:[/size][/color]
<!DOCTYPE html>
<html ng-app="lxApp" ng-controller="lxCtrl">
<head>
<title>柳絮飞祭奠</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
</head>
<body>
<div style="height: 700px;"></div>
<div infinite-scroll="mouse_scroller()">
<div ng-repeat="item in show"></div>
</div>
</body>
<script type="text/javascript" src="../plugins/angular/angular.js"></script>
<script type="text/javascript" src="../plugins/angular/ng-infinite-scroll.js"></script>
<script type="text/javascript">
var lxApp=angular.module("lxApp",['infinite-scroll']);
lxApp.controller("lxCtrl",function($scope){
$scope.mouse_scroller=function(){
//每次滚动到浏览器底部都会触发这个方法这里写你的加载数据业务。
};
});
</script>
</html>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值