我对此感到绝望。我有一个获取数据并使用此数据的信息呈现地图的组件。一切都很好。我在此地图上放置了标记,我想在标记中执行点击功能。这些函数调用组件中定义的另一个函数,并带给我数据以模态形式显示它。但是,当我单击标记时,出现以下错误:
this.getInfoAlteracion不是一个函数
我不知道为什么 我证明了很多事情,但看不到错误。这是我的代码:
import { Component, OnInit } from '@angular/core';
import * as L from 'leaflet';
import 'leaflet.markercluster';
import { MapService } from './services';
import * as global from 'app/globals';
import { Alteracion } from './dto/alteracion';
@Component({
selector: 'map',
templateUrl: './map.component.html',
styleUrls: ['./map.component.scss']
})
export class MapComponent implements OnInit {
public alteraciones: Alteracion[] = [];
public alteracion: Alteracion[] = [];
constructor(private mapService: MapService) {}
ngOnInit() {
this.getAlteraciones();
}
getAlteraciones() {
this.mapService.getListAlteraciones(11, 1).subscribe(
result => {
this.alteraciones = result;
this.renderMap(); …Run Code Online (Sandbox Code Playgroud)