导入用于angular 4的传单绘图NGX
我遵循了主git中的步骤: 首先,我安装了所需的库(传单、传单绘图、传单ngx和传单绘图ngx) 然后我在app.module中声明了所需的指令导入 在我看来,我设定了以下条件:导入用于angular 4的传单绘图NGX,angular,leaflet,angular-directive,ngx-leaflet,Angular,Leaflet,Angular Directive,Ngx Leaflet,我遵循了主git中的步骤: 首先,我安装了所需的库(传单、传单绘图、传单ngx和传单绘图ngx) 然后我在app.module中声明了所需的指令导入 在我看来,我设定了以下条件: <div class="col-md-6" style="height: 400px;" leaflet leafletDraw [leafletOptions]="options" [leafletLayers]="layers"
<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
未捕获错误:模板分析错误:
无法绑定到“FloapleDrawOptions”,因为它不是“div”的已知属性。(“fletDraw[FlookeOptions]=“options”[FlookeLayers]=“layers”[FlookeLayersControl]=“layersControl”[ERROR->][FlookeDrawOptions]=“drawOptions”>确保将传单和传单绘制模块导入到定义组件的模块中(而不仅仅是在AppModule中) 在AppModule.ts中:
import { LeafletModule } from '@asymmetrik/ngx-leaflet';
import { LeafletDrawModule } from '@asymmetrik/ngx-leaflet-draw.module';
...
imports: [
...
LeafletModule.forRoot(),
LeafletDrawModule.forRoot()
]
...
在组件的模块中:
import { LeafletModule } from '@asymmetrik/ngx-leaflet';
import { LeafletDrawModule } from '@asymmetrik/ngx-leaflet-draw.module';
...
imports: [
...
LeafletModule,
LeafletDrawModule
]
...
您是否在项目的子模块中包含组件?如果是,您还需要向该子模块添加传单模块和传单绘图模块。您看到的错误通常意味着未加载模块