A very strange behavior is happening..
This works...
https://jsfiddle.net/ymgzrped/
But this below version does not...
https://jsfiddle.net/ymgzrped/1/
I changed...
function fillInAddress()
to
function fillInAddress(mapcomponents)
Used like this (working)
autocomplete.addListener('place_changed', fillInAddress)
and this (not working)
autocomplete.addListener('place_changed', fillInAddress(new_mapcomponents))
For some reason, when I pass a parameter in, I get an error:
Unhandled Promise Rejection: TypeError: undefined is not an object (evaluating 'place.address_components')
fillInAddress — _display:176
initAutocomplete — _display:162
(anonymous function) — js:145:280
(anonymous function) — js:145:119
promiseReactionJob
https://jsfiddle.net/js/makeStreamConfig.js.map
It seems to be some sort of scoping error with the code when I pass a parameter, but not when I do not.
What would cause this?
Thank you