ngAutocomplete
ngAutocomplete copied to clipboard
Blank value when place is not found
I was testing the plunker simple example and I found when I typed 'ssdfssd' or another value out of the allowed values, the value was stored in scope anyway and I didn't need it. So, I fixed this validating 'geometry' position:
google.maps.event.addListener(scope.gPlace, 'place_changed', function() { scope.$apply(function() { scope.details = scope.gPlace.getPlace(); if (!scope.details.geometry) { scope.ngAutocomplete = ''; } else scope.ngAutocomplete = element.val(); //scope.ngAutocomplete = JSON.stringify(scope.details); }); })
is it a good way to fix it or what do you suggest instead of it?
Thanks in advance and excuses for my bad english :)
I would like to see some kind of implementation for this as well.