From c2247024cad9ec65a9894cea02556d34b3476a2e Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 21 Feb 2015 14:58:39 +0100 Subject: [PATCH 1/2] Attribute to disable filter and show all the suggestions in the list --- script/autocomplete.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/script/autocomplete.js b/script/autocomplete.js index 377ad0f..59f4694 100644 --- a/script/autocomplete.js +++ b/script/autocomplete.js @@ -12,7 +12,8 @@ app.directive('autocomplete', function() { suggestions: '=data', onType: '=onType', onSelect: '=onSelect', - autocompleteRequired: '=' + autocompleteRequired: '=', + disableFilter: '=disableFilter' }, controller: ['$scope', function($scope){ // the index of the suggestions that's currently selected @@ -49,7 +50,7 @@ app.directive('autocomplete', function() { if(watching && typeof $scope.searchParam !== 'undefined' && $scope.searchParam !== null) { $scope.completing = true; - $scope.searchFilter = $scope.searchParam; + $scope.searchFilter = $scope.disableFilter ? '' : $scope.searchParam; $scope.selectedIndex = -1; } From 80990d43aaa29cf116f7d6f4098be1659b0b6739 Mon Sep 17 00:00:00 2001 From: Neil Date: Sat, 21 Feb 2015 15:04:29 +0100 Subject: [PATCH 2/2] Add attribute to documentation --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 48cc796..4c46547 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,8 @@ You can also pass a function that receives changes with the `on-type` attribute. `autocomplete-required`: *(optional)* This attribute provides value for an `ng-required` attribute on the directive's `input` field. +`disable-filter`: *(optional)* When `true` it will not filter the results from the list of suggestions, showing all the elements in the list. Default `false`. + ## Example HTML: