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: 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; }