如何使用es6将esri-leaflet导入angular

时间:2019-02-04 05:45:45

标签: typescript ecmascript-6 typescript-typings

我已将esri传单导入到我的角度组件中。

import * as L from 'leaflet';  
declare module 'leaflet' {
    ...
}
export = L.esri;      

并导入:

import * as L from 'leaflet';
import 'esri-leaflet';

但是在调试时,console.log(L.esri);等于undefined

1 个答案:

答案 0 :(得分:0)

esri-leaflet的类型文件存在问题。选中here

以克服这种导入esri-leaflet,例如:

import * as esri from "esri-leaflet";

,然后像这样访问esri class

console.log(esri);

Demo