我正试图在我的项目中添加必应地图。我用的是角6。
我遵循了这里列出的步骤,从安装开始。我发现了一些错误,现在用堆叠溢出的解决方案解决了。再次引用此链接在第二步中我得到了以下错误:
ReferenceError:未定义提供
它来自以下代码:
provide: MapAPILoader,
deps: [],
useFactory: MapServiceProviderFactory如果有人能帮我,那就太好了。谢谢。S.O.
编辑: app.module.ts:
import {
BrowserModule
} from '@angular/platform-browser';
import {
NgModule
} from '@angular/core';
import {
AppComponent
} from './app.component';
// bing STart==========================================
/// <reference path="node_modules/bingmaps/types/MicrosoftMaps/Microsoft.Maps.All.d.ts" />
import {
MapModule,
MapAPILoader,
MarkerTypeId,
IMapOptions,
IBox,
IMarkerIconInfo,
WindowRef,
DocumentRef,
MapServiceFactory,
BingMapAPILoaderConfig,
BingMapAPILoader,
GoogleMapAPILoader,
GoogleMapAPILoaderConfig
} from 'angular-maps';
// bing End============================================
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
MapModule.forRoot()
],
providers: [
provide: MapAPILoader,
deps: [],
useFactory: MapServiceProviderFactory
],
bootstrap: [AppComponent]
})
export class AppModule {}发布于 2018-09-11 16:49:53
你应该把它放在提供者数组里,
providers: [
{ provide: MapAPILoader}
]https://stackoverflow.com/questions/52280680
复制相似问题