Created
July 10, 2014 06:45
-
-
Save srkirkland/aae435cf869bf5a1375a to your computer and use it in GitHub Desktop.
geocode just short address
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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