角度图集成角度6

问题描述 投票:0回答:1

我想在我的项目中添加bing-maps。我正在使用角6。

I have followed the steps listed here,从安装开始。我得到了一些由the solution in here from stackoverflow解决的错误。 referring to this link again在第二步我得到以下错误:

ReferenceError:提供未定义

它来自以下代码:

provide: MapAPILoader,
deps: [],
useFactory: MapServiceProviderFactory

如果有人可以帮助我,那将是很棒的。谢谢。所以。

编辑: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 {}
angular maps bing-maps
1个回答
0
投票

你应该在Provider数组中,

providers: [
    { provide: MapAPILoader}
  ]
© www.soinside.com 2019 - 2024. All rights reserved.