I'm reverse geocoding when a user clicks on a point on a google map like so:
geocoder.geocode({'location': latlng}, function(results, status) {
if (status === google.maps.GeocoderStatus.OK) {
if (results[1]) {
console.log(results[1]);
At this stage the console log for results[1] looks like
Object {address_components: Array[4], formatted_address: "Rathmines, Co. Dublin, Ireland", geometry: Object, place_id: "ChIJN6MDC6kOZ0gRIhArCabX9o4", types: Array[2]}
But then I try and pass that object in to an ng-click function when the user taps on the infowindow with the address that I have popping up, like so:
ng-click='addressPicked("+results[1]+")'
I get the error
Error: [$parse:syntax] Syntax Error: Token 'Object' is unexpected, expecting []]
at column 23 of the expression [addressPicked([object Object])] starting at [Object])].
I have this working in another application, but I am just passing through a lat & long string.
Do I need to convert the object to something else before trying to pass it through as a parameter?
Anyone come across this error before with ng-click?
Any help would be much appreciated, thanks.
resultsvariable in scope then do tryng-click='addressPicked(results[1])'