我正在尝试为我的网站使用 Google 地点的城市实现自动填充。
我的代码可以在台式机和 Android 设备上运行,但在 iPhone 上,我可以在下拉列表中看到选项列表,看起来像是我正在选择它,但它不会填充文本框。
指令:我正在尝试用 Google 搜索的一些不同方法,但没有成功解决我的问题。
app.directive('stopIt', function($timeout) {
return {
link: function(scope, element, attr) {
$timeout(function() {
var container = document.getElementsByClassName('pac-container')[0];
container.setAttribute('data-tap-disabled', 'true');
container.onclick = function() {
document.getElementById('city').blur();
};
container.addEventListener('touchend', function(e) {
e.stopImmediatePropagation();
});
}, 500);
}
};
});
HTML:
<input id="city" name="city" type="text" ng-model="account_city" stop-it
placeholder="Enter a location" autocomplete="on" googleplace />
最佳答案
你使用的是webView吗?
通常使用 Xcode 和 google SDK 管理 map /位置 (另请注意,您必须付费才能使用谷歌服务)。 如果您使用 Apple 服务(在 Apple SDK 中),它是免费的。
关于ios - Google 地点自动完成功能无法在 iPhone 上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56916925/