Angular2错误:'ControlStatic'类型中不存在属性'地理编码器'

时间:2016-07-07 13:03:12

标签: angular

我用传单制作了我的第一个angular2应用程序。 我安装了这些npm包:Leaflet&小叶控制地理编码 我保存组件时出错,我不知道他的意思是什么

“ControlStatic”类型中不存在属性“地理编码器”。

我的组件代码

// <reference path="../../typings/leaflet/leaflet.d.ts"/>

import { Component, OnInit } from '@angular/core';
import { Map } from 'leaflet';
import { MapServices } from './Map.services';
import  'leaflet-control-geocoder';

@Component({
  selector: 'map',
  pipes: [],
  providers: [MapServices],
  templateUrl: './Map.template.html'
})

export class map  implements OnInit {
    private mapService: MapServices;

    constructor(mapService: MapServices) {
       this.mapService = mapService;
    }

    ngOnInit(){
        // Initialisation de la carte (mapid étant le div qui recevra la carte)
        var map = new L.Map('mapid', {layers: [this.mapService.baseMaps.OpenStreetMap]}).setView([50.09418, 5.77521], 16);

        L.control.layers(this.mapService.baseMaps).addTo(map); 
        L.control.scale({position:'bottomright'}).addTo(map);
        var geocoder = L.Control.geocoder().addTo(map);

    } 
}

0 个答案:

没有答案