diff --git a/README.md b/README.md index 84c8fee..d7b3e09 100644 --- a/README.md +++ b/README.md @@ -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 @@ -138,6 +138,13 @@ contacts-list.html ``` +A pull-to-refresh handler may be added: + +view.html +```html + +``` + # Acknowledgements Initial inspiration and code taken from [this codepen](http://codepen.io/mikelucid/pen/mqzLc) by mikelucid diff --git a/bower.json b/bower.json index b9b8392..d492632 100644 --- a/bower.json +++ b/bower.json @@ -1,10 +1,11 @@ { "name": "ion-alpha-scroll", - "version": "0.1.2", + "version": "0.1.3", "authors": [ - "aquint " + "aquint ", + "pisapapiros " ], - "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", @@ -13,7 +14,9 @@ "alphabetical", "alphabet", "scrolling", - "index" + "index", + "pull", + "refresh" ], "license": "MIT", "ignore": [ diff --git a/src/ion-alpha-scroll.js b/src/ion-alpha-scroll.js index b4fa061..8c15899 100644 --- a/src/ion-alpha-scroll.js +++ b/src/ion-alpha-scroll.js @@ -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 = [ '', '', '
', @@ -20,7 +20,14 @@ angular.module('ion-alpha-scroll', []) '
  • {{ letter }}
  • ', '', '' - ].join('')); + ]; + + var refresher = angular.fromJson(tAttrs.refresher); + if (refresher) { + var refresherElement = ' '; + 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;