Skip to content

Instantly share code, notes, and snippets.

@srkirkland
Created July 10, 2014 06:45
Show Gist options
  • Save srkirkland/aae435cf869bf5a1375a to your computer and use it in GitHub Desktop.
Save srkirkland/aae435cf869bf5a1375a to your computer and use it in GitHub Desktop.
geocode just short address
var geocode = result.data;
if (geocode.results.length > 0) {
var address = geocode.results[0].address_components;
if (address.length > 1 & address[0].types.indexOf('street_number') !== -1 && address[1].types.indexOf('route') !== -1 ){ //want street and route
$scope.spec.address = address[0].long_name + ' ' + address[1].long_name;
} else {
$scope.spec.address = geocode.results[0].formatted_address;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment