我按照主 git 中的步骤操作: https ://github.com/Asymmetrik/ngx-leaflet
首先我安装了所需的库(leaflet、leaflet-draw、leaflet-ngx 和 leaflet-draw-ngx)
然后我在 app.module 中声明了所需的指令导入。
在我看来,我设置了以下内容:
<div class="col-md-6" style="height: 400px;"
leaflet
leafletDraw
[leafletOptions]="options"
[leafletLayers]="layers"
[leafletLayersControl]="layersControl"
[leafletDrawOptions]="drawOptions">
</div>
但我收到以下错误:
> Uncaught Error: Template parse errors:
Can't bind to 'leafletDrawOptions' since it isn't a known property of 'div'. ("fletDraw [leafletOptions]="options" [leafletLayers]="layers" [leafletLayersControl]="layersControl" [ERROR ->][leafletDrawOptions]="drawOptions"> </div> <div class="col-md-6"> <table class="table table-striped c"): ng:///gxxxx.html@0:258
at syntaxError (compiler.es5.js?524d:1689)
at TemplateParser.parse (compiler.es5.js?524d:12802)
at JitCompiler._compileTemplate (compiler.es5.js?524d:26852)
at eval (compiler.es5.js?524d:26772)
at Set.forEach (<anonymous>)
at JitCompiler._compileComponents (compiler.es5.js?524d:26772)
at eval (compiler.es5.js?524d:26659)
at Object.then (compiler.es5.js?524d:1679)
at JitCompiler._compileModuleAndComponents (compiler.es5.js?524d:26658)
at JitCompiler.compileModuleAsync
我是 Angular 4 的新手,我做错了什么?还是与ES版本有关?