ich verwendet Google die automatische Vervollständigung in meinem Projekt, es funktioniert in der lokalen Ordnung, aber nicht auf dem Server arbeiten, Hier ist mein CodeAngular google Ort Auto-Vervollständigen funktioniert nicht
app.js
angular.module('MaterialApp', [
'ui.router', 'ngAnimate', 'ngMaterial',
'ngSanitize', 'ui.sortable', 'base64',
'angular-md5', 'blockUI', 'oc.lazyLoad',
'ngMdIcons', 'md.data.table', 'highcharts-ng',
'google.places', 'ui.calendar', 'ui.date',
'easypiechart', 'ngFileUpload', 'ngCookies',
"isoCurrency", "ngBootstrap", "datatables", "authService", "companyService" // "templatescache"])
Form .html
<div class="form-group group-pro">
<div class="group-row col-sm-10 col-sm-push-1">
<input class="form-control control-set" ng-model="campaign.location_data" name="location_data" type="text" g-places-autocomplete id="location_data" placeholder="Enter the location you want to target" force-selection="true" autocomplete="on" required=""/>
<div ng-show="createCampaignForm.$submitted || createCampaignForm.location_data.$touched" ng-model="createCampaignForm.location_data">
<span ng-show="createCampaignForm.location_data.$error.required" class="text-danger">Please enter location data.</span>
</div>
</div>
</div>
mein controller.js
$scope.$on('g-places-autocomplete:select', function (event, place) {
console.log(event);
console.log(place);
var componentForm = {
locality: 'city', //city
administrative_area_level_1: 'region', //state
country: 'country' //country
}, place_selection_val = [];
for (var cFKey in componentForm) {
$scope.campaign[componentForm[cFKey]] = null;
}
for (var i = 0; i < place.address_components.length; i++) {
var addressType = place.address_components[i].types[0];
if (componentForm[addressType]) {
var val = place.address_components[i].short_name;
place_selection_val.push(val);
$scope.campaign[componentForm[addressType]] = val;
}
}
$scope.campaign.location_data = place_selection_val.join(', ').replace(/^\s+|\s+$/g, '');
});
bitte helfen Sie mir, warum es nicht auf Server funktioniert.
Dank Douglas, Google Places API-Webdienst ist bereits aktiviert, In meinem Projekt ich das Projekt mit Knoten js erstellen und in generierte dist es nicht gefunden.direct API-Links nicht funktioniert. Warum passiert das? Bitte führen Sie mich.Kann ich diese Bibliothek herunterladen und statischen Pfad geben. – Kirit