【发布时间】:2017-01-25 23:01:24
【问题描述】:
我实际上遇到了同样的问题:
can't tap on item in google autocomplete list on mobile
简而言之:我点了 google 的自动补全建议,它在移动设备上不起作用,而在 PC 上运行正常。
但是:我没有使用 cordova,只是使用 nodejs 和响应能力的普通角度。我确实启用了 FastClick,但禁用并没有解决问题....
编辑:这是我的完整性代码: 标记(玉):
div
input(type="text" id="fulladdress" name="fulladdress" ng-model="location" class="form-control text-field" placeholder="Start typing...")
在视图中:
form.row(ng-show="vm.isLogged" name="vm.form")
h2.order-title Delivery address
label(for="address") Address
google-places(location="vm.address")
js:
'use strict';
GooglePlacesDirective.$inject = ['$animate', 'Zipcode'];
function GooglePlacesDirective($animate, Zipcode) {
return {
scope: {location:'='},
restrict: 'E',
replace: true,
template: require('./google-places.html'),
link: link
};
function link(scope, element) {
scope.codeNotServed = false;
var options = {
componentRestrictions: {country: "us"}
};
var autocomplete = new google.maps.places.Autocomplete($("#fulladdress")[0], options);
google.maps.event.addListener(autocomplete, 'place_changed', function() {
scope.codeNotServed = false;
var place = autocomplete.getPlace();
var parts = place.address_components;
//do things with the parts; I've also tried doing nothing with the parts, but it didn't work either
});
}
}
module.exports = GooglePlacesDirective;
【问题讨论】:
标签: javascript angularjs autocomplete