Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added search type property to ionicFilterBar scope #48

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions dist/ionic.filter.bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ angular.module('jett.ionic.filter.bar', ['ionic']);
'<div class="bar bar-header bar-{{::config.theme}} item-input-inset">' +
'<button class="filter-bar-cancel button button-icon icon {{::config.back}}"></button>' +
'<label class="item-input-wrapper">' +
'<input type="search" class="filter-bar-search" ng-model="data.filterText" placeholder="{{::config.placeholder}}" />' +
'<input type="{{::searchType}}" class="filter-bar-search" ng-model="data.filterText" placeholder="{{::config.placeholder}}" />' +
'<button class="filter-bar-clear button button-icon icon" ng-class="getClearButtonClass()"></button>' +
'</label>' +
'</div>' +
Expand All @@ -28,7 +28,7 @@ angular.module('jett.ionic.filter.bar', ['ionic']);
'<div class="bar bar-header bar-{{::config.theme}} item-input-inset">' +
'<label class="item-input-wrapper">' +
'<i class="icon {{::config.search}} placeholder-icon"></i>' +
'<input type="search" class="filter-bar-search" ng-model="data.filterText" placeholder="{{::config.placeholder}}"/>' +
'<input type="{{::searchType}}" class="filter-bar-search" ng-model="data.filterText" placeholder="{{::config.placeholder}}"/>' +
'<button class="filter-bar-clear button button-icon icon" ng-class="getClearButtonClass()"></button>' +
'</label>' +
'<button class="filter-bar-cancel button button-clear" ng-bind-html="::cancelText"></button>' +
Expand Down Expand Up @@ -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: ''};
Expand Down Expand Up @@ -535,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) {
Expand Down