我试图使用“角映射”npm包在角6中实现bingmap,因为我有请参阅和转介问题声明:在node_modules中没有创建“bingmap”文件夹。
app.module.ts
/// <reference path="node_modules/bingmaps/types/MicrosoftMaps/Microsoft.Maps.All.d.ts" />
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { MapModule, MapAPILoader, BingMapAPILoaderConfig, BingMapAPILoader, WindowRef, DocumentRef, MapServiceFactory, BingMapServiceFactory } from "angular-maps";
import { AppComponent } from './app.component';错误:
在./node_modules/angular-maps/fesm5/angular-maps.js模块中找不到错误:错误:无法解决'D:\bingmap\bingmap\node_modules\angular-maps\fesm5‘i“’D:\bingmap\bingmap\node_modules\angular-maps\fesm5‘”中的’bingmap‘:编译失败。src/app/app.module.ts(1,23)中出现错误: ERROR TS6053: File TS6053 not。
还安装了npm install --save @types/bingmaps
发布于 2018-08-23 15:23:22
我刚刚在stackblitz上进行了本地测试,并意识到为了使角度映射工作,您必须安装一些库依赖项。我收到了与您相同的错误,但是一旦安装了库,错误就消失了。
您的package.json应该包含以下库:
"@types/bingmaps": "0.0.1",
"angular-maps": "^6.0.1",
"async": "^2.5.0",
"bingmaps": "^2.0.3",
"core-js": "^2.5.4",
"font-awesome": "^4.6.3",
"json-loader": "^0.5.7", 所以你需要安装它们
npm install --save angular-maps
npm install --save bingmaps
npm install --save @types/bingmaps
npm install --save async@2.5.0
npm install --save json-loader我在index.html中包含了字体-超赞作为外部链接:
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet" />在app.module.ts上包括这一点,以及在app.component.ts上:
import {
MapModule,
MapAPILoader,
MarkerTypeId,
IMapOptions,
IBox,
IMarkerIconInfo,
WindowRef,
DocumentRef,
MapServiceFactory,
BingMapAPILoaderConfig,
BingMapAPILoader,
GoogleMapAPILoader,
GoogleMapAPILoaderConfig
} from 'angular-maps';如果您也检查了stackblitz,就可以看到使用了哪些额外的库。
https://stackoverflow.com/questions/51987104
复制相似问题