From 2eb550af3ce904d32bb1195e9f6af48f2ad0a612 Mon Sep 17 00:00:00 2001 From: Andy Joslin Date: Thu, 24 Apr 2014 09:49:49 -0600 Subject: [PATCH] demo(collection-repeat): add clear button --- demos/collection-repeat/index.html | 12 +++++++++++- demos/collection-repeat/script.js | 3 ++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/demos/collection-repeat/index.html b/demos/collection-repeat/index.html index 6e6c76f271..6621c6e084 100644 --- a/demos/collection-repeat/index.html +++ b/demos/collection-repeat/index.html @@ -18,6 +18,10 @@ +
@@ -33,7 +37,7 @@
+ ng-style="{top: (100/letters.length)*$index + '%'}"> {{letter}}
@@ -54,6 +58,12 @@ position: absolute; z-index: 100; } +.button.button-icon.input-button { + position: absolute; + right: 0; + top: 5px; + color: #bbb; +} diff --git a/demos/collection-repeat/script.js b/demos/collection-repeat/script.js index 7af0ae456c..ca679ddac4 100644 --- a/demos/collection-repeat/script.js +++ b/demos/collection-repeat/script.js @@ -42,11 +42,12 @@ angular.module('contactsApp', ['ionic']) return item.isLetter ? 38 : 52; }; + var letterHasMatch = {}; $scope.getContacts = function() { + letterHasMatch = {}; //Filter contacts by $scope.search. //Additionally, filter letters so that they only show if there //is one or more matching contact - var letterHasMatch = {}; return contacts.filter(function(item) { var itemDoesMatch = !$scope.search || item.isLetter || item.first_name.toLowerCase().indexOf($scope.search.toLowerCase()) > -1 ||