Google Places自动完成功能无法在iPhone上使用

时间:2019-07-06 19:06:44

标签: ios angularjs iphone

我正在尝试使用我的网站的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 />

1 个答案:

答案 0 :(得分:0)

您是否正在使用webView?

通常,地图/位置由Xcode和google SDK管理 (请注意,您必须付费才能使用Google服务)。 如果您使用Apple服务(在Apple SDK中),则它是免费的。

相关问题