Skip to content
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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 3 additions & 2 deletions script/autocomplete.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down