Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
ion-alpha-scroll
================

> Configurable Ionic directive for alphabetically indexed list with an alpha scroll bar.
> Configurable Ionic directive for alphabetically indexed list with an alpha scroll bar. Provides a pull-to-refresh option.

#Table of contents

Expand Down Expand Up @@ -138,6 +138,13 @@ contacts-list.html
</ion-view>
```

A pull-to-refresh handler may be added:

view.html
```html
<ion-alpha-scroll ng-model="companies" key="name" refresher='{"text": "Pull to refresh", "callback": "refresh(true)"}'>
```

# Acknowledgements

Initial inspiration and code taken from [this codepen](http://codepen.io/mikelucid/pen/mqzLc) by mikelucid
Expand Down
11 changes: 7 additions & 4 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
{
"name": "ion-alpha-scroll",
"version": "0.1.2",
"version": "0.1.3",
"authors": [
"aquint <anthonyquinton92@gmail.com>"
"aquint <anthonyquinton92@gmail.com>",
"pisapapiros <pcamino90@gmail.com>"
],
"description": "Alphabetical indexing and scrolling for ionic lists",
"description": "Alphabetical indexing and scrolling for ionic lists with pull-to-refresh option.",
"main": "./src/ion-alpha-scroll.js",
"keywords": [
"ionic",
Expand All @@ -13,7 +14,9 @@
"alphabetical",
"alphabet",
"scrolling",
"index"
"index",
"pull",
"refresh"
],
"license": "MIT",
"ignore": [
Expand Down
11 changes: 9 additions & 2 deletions src/ion-alpha-scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ angular.module('ion-alpha-scroll', [])
replace: true,
compile: function(tElement, tAttrs, tTransclude) {
var children = tElement.contents();
var template = angular.element([
var templateElements = [
'<ion-list class="ion_alpha_list_outer">',
'<ion-scroll delegate-handle="alphaScroll">',
'<div data-ng-repeat="(letter, items) in sorted_items" class="ion_alpha_list">',
Expand All @@ -20,7 +20,14 @@ angular.module('ion-alpha-scroll', [])
'<li ng-click="alphaScrollGoToList(\'index_{{letter}}\')" ng-repeat="letter in alphabet | orderBy: letter">{{ letter }}</li>',
'</ul>',
'</ion-list>'
].join(''));
];

var refresher = angular.fromJson(tAttrs.refresher);
if (refresher) {
var refresherElement = '<ion-refresher pulling-text="' + refresher.text + '" on-refresh="' + refresher.callback + '"> </ion-refresher>';
templateElements.splice(2, 0, refresherElement);
}
var template = angular.element(templateElements.join(''));

var headerHeight = $document[0].body.querySelector('.bar-header').offsetHeight;
var subHeaderHeight = tAttrs.subheader === "true" ? 44 : 0;
Expand Down