繁体   English   中英

试图多次加载角度+在此页面上多次包含Google Maps API

[英]Tried to load angular more than once + included the Google Maps API multiple times on this page

每当我按网站上的“开始使用”按钮时,屏幕就会变黑,并且控制台日志中出现以下错误。 在运行grunt build并将其部署到Heroku之前,我没有在本地看到此问题:

WARNING: Tried to load angular more than once.

You have included the Google Maps API multiple times on this page. This may cause unexpected errors.

我的index.html的代码如下,完整代码在这里

  <script src="https://maps.googleapis.com/maps/api/js?libraries=places&key=AIzaSyBHuxIv-E8l4YRp_vWjW7X22gRNwI1xN30"></script>
  <!-- build:js(.) scripts/vendor.js -->
  <!-- bower:js -->
  <script src="bower_components/jquery/dist/jquery.js"></script>
  <script src="bower_components/angular/angular.js"></script>
  <script src="bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js"></script>
  <script src="bower_components/angular-animate/angular-animate.js"></script>
  <script src="bower_components/angular-cookies/angular-cookies.js"></script>
  <script src="bower_components/angular-resource/angular-resource.js"></script>
  <script src="bower_components/angular-route/angular-route.js"></script>
  <script src="bower_components/angular-sanitize/angular-sanitize.js"></script>
  <script src="bower_components/angular-touch/angular-touch.js"></script>
  <script src="bower_components/ngstorage/ngStorage.js"></script>
  <script src="bower_components/moment/moment.js"></script>
  <script src="bower_components/angular-moment/angular-moment.js"></script>
  <script src="bower_components/angular-strap/dist/angular-strap.js"></script>
  <script src="bower_components/angular-strap/dist/angular-strap.tpl.js"></script>
  <script src="bower_components/angular-modal-service/dst/angular-modal-service.js"></script>
  <script src="bower_components/vsGoogleAutocomplete/dist/vs-google-autocomplete.js"></script>
  <script src="bower_components/vsGoogleAutocomplete/dist/vs-autocomplete-validator.js"></script>
  <!-- endbower -->
  <!-- endbuild -->

不知道还有什么可能导致此问题? 有人可以帮忙吗?

更新

我还包括了Grunt任务: https : //pastebin.com/3JiaQwXU

在开发控制台中分析页面后,看来您确实确实在加载脚本两次。 我会解释。

跟随下面的图片 在此处输入图片说明

在单击“入门”时,您基本上将再次加载整个页面。 检查getstarted.html html。 如果您打算使用模板,则模板应该只包含视图的一部分,而不是最顶部的整个站点。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM