From 325edbb18ba6d025ee0c48ad173d125f42451a6c Mon Sep 17 00:00:00 2001 From: Murray Wynnes Date: Sun, 27 Sep 2015 18:45:44 +0100 Subject: [PATCH 1/2] Added search type property to ionicFilterBar scope --- README.md | 5 +++++ dist/ionic.filter.bar.js | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7e1c63b..9c23673 100644 --- a/README.md +++ b/README.md @@ -256,6 +256,11 @@ A service you can inject in your controller to show the filter bar should be considered a match. This is the same as the angular filter `comparator` argument described [here](https://docs.angularjs.org/api/ng/filter/filter). Default value is `undefined`. + - `{string=}` `searchType` + + A string which sets the HTML5 search input type. Examples include search, text, email, tel, number, date, month, password. Full list available [here](http://ionicframework.com/html5-input-types/). + Default value is `search`. + - `[String]` `filterProperties` A string or string array of object properties that will be used to create a filterExpression object for diff --git a/dist/ionic.filter.bar.js b/dist/ionic.filter.bar.js index b7e9e87..1fe939e 100644 --- a/dist/ionic.filter.bar.js +++ b/dist/ionic.filter.bar.js @@ -17,7 +17,7 @@ angular.module('jett.ionic.filter.bar', ['ionic']); '
' + '' + '' + '
' + @@ -28,7 +28,7 @@ angular.module('jett.ionic.filter.bar', ['ionic']); '
' + '' + '' + @@ -438,7 +438,8 @@ angular.module('jett.ionic.filter.bar', ['ionic']); favoritesTitle: 'Favorite Searches', favoritesAddPlaceholder: 'Add a search term', favoritesEnabled: false, - favoritesKey: 'ionic_filter_bar_favorites' + favoritesKey: 'ionic_filter_bar_favorites', + searchType: 'search' }, opts); scope.data = {filterText: ''}; From 8fdc74c7268c0300fd9f903185eea67e1ff47ad9 Mon Sep 17 00:00:00 2001 From: Murray Wynnes Date: Tue, 29 Sep 2015 23:51:37 +0100 Subject: [PATCH 2/2] casting the input from the textbook to string This is to handle numbers or dates gracefully, they contain digits and have length undefined --- dist/ionic.filter.bar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/ionic.filter.bar.js b/dist/ionic.filter.bar.js index 1fe939e..c8b72e8 100644 --- a/dist/ionic.filter.bar.js +++ b/dist/ionic.filter.bar.js @@ -536,7 +536,7 @@ angular.module('jett.ionic.filter.bar', ['ionic']); // pass back original list if filterText is empty. // Otherwise filter by expression, supplied properties, or filterText. - if (!filterText.length) { + if (!(filterText.toString().length)) { filteredItems = scope.items; } else { if (scope.expression) {