kuhnza / angular-google-places-autocomplete

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

$scope.apply error when backspacing chosen place #20

Open ghoward500 opened 9 years ago

ghoward500 commented 9 years ago

After I choose a prediction from the list, if I go to the end of the text in the input and hold down backspace to erase the text in the input field there is an error thrown for $scope.apply as it is removing text: Error: [$rootScope:inprog] $apply already in progress http://errors.angularjs.org/1.3.5/$rootScope/inprog?p0=%24apply at REGEX_STRING_REGEXP (.../js/angular.js:63:12) at beginPhase (.../js/angular.js:14644:15) at Scope.$get.Scope.$apply (.../js/angular.js:14388:11) at .../js/autocomplete.js:190:36 at C8 (eval at (eval at (eval at (eval at (https://maps.gstatic.com/maps-api-v3/api/js/20/6/main.js:60:931)))), :17:495) at B8.(anonymous function).getPlacePredictions (eval at (eval at (eval at (eval at (https://maps.gstatic.com/maps-api-v3/api/js/20/6/main.js:60:931)))), :18:45) at Ll.eval (eval at (https://maps.gstatic.com/maps-api-v3/api/js/20/6/main.js:60:931), :1:388) at https://maps.gstatic.com/maps-api-v3/api/js/20/6/main.js:15:265 at ag (https://maps.gstatic.com/maps-api-v3/api/js/20/6/main.js:27:432) at Ll.(anonymous function).getPlacePredictions (eval at (https://maps.gstatic.com/maps-api-v3/api/js/20/6/main.js:60:931), :1:345)

It happens every time I test it and does not seem random.

Let me know if you need additional information. Thanks for the module, it has been working great other than this slight issue!

evba1 commented 8 years ago

following #47 I fixed this by modifying in line 192 "$scope.$apply(..." with $timeout. This worked for me..

cmkramer commented 8 years ago

Turned it into a pull request: https://github.com/kuhnza/angular-google-places-autocomplete/pull/75

ericklombardo commented 7 years ago

I got the same problem........replace $apply with $timeout also works for me