kuhnza / angular-google-places-autocomplete

Pure AngularJS directive for Google Places Autocomplete
MIT License
257 stars 189 forks source link

Let user clear the input with forceSelect set to true #100

Open DamodarSojka opened 8 years ago

DamodarSojka commented 8 years ago

I would like to let users to clear selecting but on the same time restrict choice to options from predictions. When clearing input using backspace onBlur listener reselects last selection on line 135: if ($scope.forceSelection) { $scope.selected = ($scope.selected === -1) ? 0 : $scope.selected; } Input can be safely cleared by selecting whole input with for example ctrl-a and pressing backspace/delete. In such case first check ($scope.predictions.length === 0) in onBlur returns true and input gets cleared.

It seems that when input gets cleared predictions should also get cleared.