-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #228 from angular-ui/buffer-first-last-length
Buffer first, last, length
- Loading branch information
Showing
14 changed files
with
211 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<!doctype html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="utf-8"> | ||
<title>Buffer first, last, length</title> | ||
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.7.1/angular.js"></script> | ||
<script src="../../dist/ui-scroll.js"></script> | ||
<script src="bufferItems.js"></script> | ||
<link rel="stylesheet" href="../css/style.css" type="text/css" /> | ||
</head> | ||
|
||
<body ng-app="application" ng-controller="mainController"> | ||
|
||
<div class="cont cont-global"> | ||
|
||
<a class="back" href="../index.html">browse other examples</a> | ||
|
||
<h1 class="page-header page-header-exapmle">Buffer first, last, length</h1> | ||
|
||
<div class="description"> | ||
The ui-scroll Adapter has 3 read-only properties which provide information of current ui-scroll Buffer state. | ||
The buffer contains some visible items and some items that are out of visible part of the viewport. | ||
So with these properties we can get the topmost and the bottommost items that the ui-scroll is dealing with at the moment. | ||
At the template's layer it may look like | ||
|
||
<div class="code"> | ||
<pre>{{adapter.bufferFirst}<!---->} | ||
{{adapter.bufferLast}<!---->} | ||
{{adapter.bufferLength}<!---->} | ||
|
||
<li ui-scroll="item in datasource" adapter="adapter">{{item}<!---->}</li></pre> | ||
</div> | ||
</div> | ||
|
||
<div class="info"> | ||
<div class="info-item"><span class="info-item-label">First buffer</span> {{adapter.bufferFirst}}</div> | ||
<div class="info-item"><span class="info-item-label">Last buffer</span> {{adapter.bufferLast}}</div> | ||
<div class="info-item"><span class="info-item-label">Buffer length:</span> {{adapter.bufferLength}}</div> | ||
</div> | ||
|
||
<div class="viewport" id="viewport-listScroller" ui-scroll-viewport> | ||
<ul> | ||
<li ui-scroll="item in datasource" adapter="adapter">{{item}}</li> | ||
</ul> | ||
</div> | ||
|
||
</div> | ||
|
||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
angular.module('application', ['ui.scroll']) | ||
.controller('mainController', [ | ||
'$scope', '$log', '$timeout', function ($scope, console, $timeout) { | ||
|
||
$scope.adapter = {}; | ||
|
||
$scope.datasource = {}; | ||
|
||
$scope.datasource.get = function (index, count, success) { | ||
$timeout(function () { | ||
var result = []; | ||
for (var i = index; i <= index + count - 1; i++) { | ||
result.push("item #" + i); | ||
} | ||
success(result); | ||
}, 0); | ||
}; | ||
|
||
} | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters