无法绑定到 'leafletMarkerCluster',因为它不是 'div' 的已知 属性
Can't bind to 'leafletMarkerCluster' since it isn't a known property of 'div'
我在 angular 5 应用程序中使用 ngx-leaflet-markercluster。我根据演示更改了我的代码,但仍然出现以下错误:
Can't bind to 'leafletMarkerCluster' since it isn't a known property of 'div'.
有什么想法吗?有人试过 v1.0.0 了吗?
确保将 LeafletMarkerclusterModule
导入应用程序的适当模块(类似于您对 ngx-leaflet 模块所做的操作)。此错误通常是由于 Angular 未识别指令引起的,因为尚未导入模块。
例如,确保您在其中使用 ngx-leaflet 和 ngx-leaflet-markercluster 的模块如下所示:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { LeafletModule } from '@asymmetrik/ngx-leaflet';
import { LeafletMarkerClusterModule } from '@asymmetrik/ngx-leaflet-markercluster';
@NgModule({
imports: [
CommonModule,
FormsModule,
LeafletModule.forRoot(),
LeafletMarkerClusterModule.forRoot()
],
declarations: [
MyComponent
],
exports: [
MyComponent
],
bootstrap: [ MyComponent ],
providers: [ ]
})
export class MyModule { }
我在 angular 5 应用程序中使用 ngx-leaflet-markercluster。我根据演示更改了我的代码,但仍然出现以下错误:
Can't bind to 'leafletMarkerCluster' since it isn't a known property of 'div'.
有什么想法吗?有人试过 v1.0.0 了吗?
确保将 LeafletMarkerclusterModule
导入应用程序的适当模块(类似于您对 ngx-leaflet 模块所做的操作)。此错误通常是由于 Angular 未识别指令引起的,因为尚未导入模块。
例如,确保您在其中使用 ngx-leaflet 和 ngx-leaflet-markercluster 的模块如下所示:
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { LeafletModule } from '@asymmetrik/ngx-leaflet';
import { LeafletMarkerClusterModule } from '@asymmetrik/ngx-leaflet-markercluster';
@NgModule({
imports: [
CommonModule,
FormsModule,
LeafletModule.forRoot(),
LeafletMarkerClusterModule.forRoot()
],
declarations: [
MyComponent
],
exports: [
MyComponent
],
bootstrap: [ MyComponent ],
providers: [ ]
})
export class MyModule { }