Ионная сборка говорит: свойство '' не существует по типу '' - PullRequest
0 голосов
/ 05 февраля 2019

, когда я пытаюсь построить этот код в ionic3, он показывает мне следующее предупреждение: свойство 'tempIcon' не существует для типа 'MapService'.

ионная сборка

import { Injectable } from "@angular/core";
import { BaseLayersService } from "./base-layers.service";
import { WmsLayersService } from "./wms-layers.service";
import { ToastController } from 'ionic-angular';
import L from "leaflet";

@Injectable()
export class MapService {
public map: L.Map;
constructor(private wmsLayersService: WmsLayersService, private baseLayersService: BaseLayersService, public toastCtrl: ToastController) {
}
loadMap() {

  this.tempIcon = L.icon({
        iconUrl: 'assets/imgs/position.png',
        shadowUrl: '',
        iconSize: [48, 48], // size of the icon
        shadowSize: [0, 0], // size of the shadow
        iconAnchor: [48, 48], // point of the icon which will correspond to markers location
        shadowAnchor: [0, 0], // the same for the shadow
        popupAnchor: [48, 48] // point from which the popup should open relative to the iconAnchor
    });

const map = L.map("map", {
  //layers: [this.baseLayersService.baseLayers.OpenStreetMap, this.wmsLayersService.wmsLayers.Falabella]
   layers: [this.wmsLayersService.wmsLayers.Falabella, this.baseLayersService.baseLayers.CartoDB ] 
});

L.control.layers(this.baseLayersService.baseLayers, this.wmsLayersService.wmsLayers).addTo(map);
L.control.scale().addTo(map);

1 Ответ

0 голосов
/ 05 февраля 2019

Я думаю, вы не заявили об этом.просто попытайтесь объявить это как

public map: L.Map;
public tempIcon: any;
...