简体   繁体   English

Angular 6:Bing Map 在 angular-component-library 中使用时未加载

[英]Angular 6 : Bing Map not loading when used in angular-component-library

I have created angular-component-library in Angular 6.I am trying to use this library in other angular project.我在 Angular 6 中创建了 angular-component-library。我试图在其他 angular 项目中使用这个库。

Actually this library contains Bing Map only.实际上这个库只包含 Bing Map。

Issue is I'm getting " Microsoft is not defined " on the page where I have integrated this library.问题是我在集成此库的页面上收到“ Microsoft 未定义”。

Following is my library code.以下是我的库代码。

Bing Map Component必应地图组件

必应地图组件

Bing Map HTML必应地图 HTML

必应地图组件 HTML

I just suspect that my library is not able to find Microsoft instance to load bing map but don't know why.我只是怀疑我的库无法找到 Microsoft 实例来加载 bing 地图,但不知道为什么。

Remove "async defer" from the Bing Maps script reference.从 Bing Maps 脚本参考中删除“async defer”。 When you specify this the javascript files load asynchronously and are deferred.当您指定此项时,javascript 文件会异步加载并被推迟。 As a result you are trying to access the Microsoft namespace before it has been loaded.因此,您试图在加载之前访问 Microsoft 命名空间。 Alternatively, add a callback function name to the script URL.或者,将回调函数名称添加到脚本 URL。

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

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