地图容器已初始化

时间:2017-09-01 02:16:49

标签: angular components

我尝试在angular2中的组件之间获取坐标数据,例如:我将数据从sliders.component发送到map.component通过home.component同时将data.component中的数据发送到info.component通过home.component。终端没问题但错误发生在html的控制台上。

map.component中的initmap()。我不知道同一组件是否允许同时发送和加入数据或原因是错误的代码的原因。

home.component.html的代码:

<app-maps (notify)="getNotification($event)"></app-maps>
<app-sliders (onDatePicked)="doSomething($event)"></app-sliders>    
<app-maps  [data]="evt"></app-maps>
<app-infos  [data]="spot"></app-infos>

错误在于:

ERROR Error: Map container is already initialized.
    at NewClass._initContainer (leaflet-src.js:3946)
    at NewClass.initialize (leaflet-src.js:3037)
    at new NewClass (leaflet-src.js:300)
    at Object.createMap [as map] (leaflet-src.js:4552)
    at MapsComponent.webpackJsonp.../../../../../src/app/maps/maps.component.ts.MapsComponent.initMap (maps.component.ts:74)
    at MapsComponent.webpackJsonp.../../../../../src/app/maps/maps.component.ts.MapsComponent.ngOnInit (maps.component.ts:90)
    at checkAndUpdateDirectiveInline (core.es5.js:10836)
    at checkAndUpdateNodeInline (core.es5.js:12332)
    at checkAndUpdateNode (core.es5.js:12271)
    at debugCheckAndUpdateNode (core.es5.js:13132)

0 个答案:

没有答案