Vin*_*rel 2 google-maps internet-explorer-11 angular6
我的应用程序网站在IE11上无法正常工作。
网站未加载,给我空白页
这是在IE11上引发的错误:
SCRIPT5005: String expected
js (26,286)
SCRIPT5022: Exception thrown and not caught.
polyfills.js (3234,3)
Run Code Online (Sandbox Code Playgroud)
我将屏幕截图封装在控制台上
我已经将API包含在其中my index.html
:
<script type="text/javascript" src="https://maps.googleapis.com/maps/api/js?key=API_KEY"></script>
Run Code Online (Sandbox Code Playgroud)
它应该在我的polyfills.js之后包含googlemaps,但是我不确定如何做到这一点
我尝试使用agm-map和其他解决方案,但到目前为止,没有任何效果。
小智 5
You could add the Google Maps script to the ngOnInit() method instead of in the tag.
let googleMapsScript = document.createElement('script')
googleMapsScript.setAttribute('src', 'https://maps.google.com/maps/api/js?v=3.38&key=YOURGOOGLEMAPSAPIKEY&libraries=places')
document.head.appendChild(googleMapsScript)
Run Code Online (Sandbox Code Playgroud)
This will load the Google Maps script after the main JS for the application is loaded. I don't use Angular but a similar approach works well in VueJS.
归档时间: |
|
查看次数: |
1009 次 |
最近记录: |