Skip to content

Instantly share code, notes, and snippets.

@whatnickcodes
Created February 23, 2015 17:22
Show Gist options
  • Save whatnickcodes/864504cb5a3a6ea62048 to your computer and use it in GitHub Desktop.
Save whatnickcodes/864504cb5a3a6ea62048 to your computer and use it in GitHub Desktop.
callback
GoogleApi.geocodeAddress(vm.formData.address)
.success(function(data) {
// vm.processing = false;
if (data.status == 'ZERO_RESULTS') {
// Show Message
console.log('not good to goo');
} else if (data.status == 'OK' && data.results.length > 1) {
// Show message
console.log('too many results');
} else {
Affiliate.search(data.results[0].geometry.location)
.success(function(data) {
if (!data.is_success) {
// Show message
console.log('no nearby locations');
} else {
vm.affiliates = data.results;
}
})
.error(handleError);
}
})
.error(handleError);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment