I am trying to use Google geocoding API. However I am getting following error even after mentioning API key This service requires an API key. For more information on authentication and Google Maps JavaScript API
Following is my HTML entry with API key:
<script src="//maps.googleapis.com/maps/api/js?v=3.exp&key=AIzaSyAa7LqHyZpHtQBGR6415pYu1FnwWQBPcnY" type="text/javascript"></script>
and this is the angularjs code where I am getting REQEST_DENIED
function geocode(dataset){
var coords = [];
var address = dataset.address;
var geocoder = new google.maps.Geocoder();
var defer = $q.defer();
geocoder.geocode({'address': address}, function( results, status ) {
if (status === google.maps.GeocoderStatus.OK) {
coords[0] = results[0].geometry.location.lat();
coords[1] = results[0].geometry.location.lng();
dataset["coordinates"]=results[0].geometry.location;
defer.resolve(dataset);
}
else {
coords = 'Could not retrieve coordinates for: ' + address;
defer.reject();
}
});
return defer.promise;
}
Is there something I am missing? Thank you.