我是这个领域的新手,并试图在我的应用程序上实现谷歌的自动完成,比如这个https://plnkr.co/edit/GUs28h2ncbbhx8dEmiz5?p=preview。这是一个非常简单的例子,只是为了测试谷歌地图。但是自动完成的下列总是在模式之外,您可以按下登录并输入地址,您可以看到它。你知道这是为什么吗?
<!DOCTYPE html>
<html lang="en" ng-app='myApp'>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places"></script>
<script src="all.js"></script>
<!--link rel="stylesheet" href="main.css"-->
</head>
<body ng-controller="mainControl as mc">
<div>
<div ng-hide="mc.values.logged">
<button type="button" class="btn" data-toggle="modal" data-target=".logIn">Log In</button>
</div>
</div>
<div class="logIn modal fade" id="logIn" ng-controller='logInControl as lc'>
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<form id="eventForm" name="eventForm" ng-submit="ec.submit()">
<label for="locationTextField">Location</label>
<input id="locationTextField" type="text" size="50">
</form>
</div>
</div>
</div>
</div>
</body>
</html>顺便问一下,我还有一个问题,我成功地申请了一个API-key,但是我不能用它替换链接。
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBDhab7yuMx-2lllD8kwZIF-yIVGnsCx-0&libraries=places"></script> 你能告诉我为什么吗?

发布于 2016-11-10 15:29:09
基于第4160期登录的问题跟踪器,您可以尝试将google自动完成下拉结果放在引导模式1050 zindex之上,如下所示:
.pac-container {
z-index: 1051 !important;
}还请检查这些相关帖子中提出的解决方案:
另一方面,关于您的API键,请检查出现在控制台中的错误代码或消息,然后检查如何在Google API错误代码和用于开发人员的Google API错误代码中修复它。
此无效的API密钥相关所以贴也可能对您有所帮助。
编码愉快!
https://stackoverflow.com/questions/40454710
复制相似问题