Google autocomplete place search box shows "oops , something went wrong." .My code here`
routerApp.directive('googleplace', function(){
return {
require: 'ngModel',
link: function(scope, element, attrs, model){
var options = {
types: [],
componentRestrictions: {}
};
scope.gPlace = new google.maps.places.Autocomplete(element[0], options);
google.maps.event.addListener(scope.gPlace, 'place_changed', function(e) {
scope.$apply(function() {
model.$setViewValue(element.val());
var countrycode = "na";
scope.secondplacebox = scope.chosenPlace;
for(var i = 0; i < scope.gPlace.getPlace().address_components.length; i++)
{
if(scope.gPlace.getPlace().address_components[i].types[0] == 'country')
{
countrycode = scope.gPlace.getPlace().address_components[i].short_name;
}
}
var latitude = scope.gPlace.getPlace().geometry.location.lat().toFixed(6);
var longitude = scope.gPlace.getPlace().geometry.location.lng().toFixed(6);
scope.Fn_SearchFood(latitude,longitude,scope.date,countrycode);
});
});
}
};
});
and I am using
<script type="text/javascript" src="http://maps.google.com/maps/api/js?libraries=places&key=API_KEY"></script>
Please show me an example to give project url in the google api console. Please help,Thanks in advance.