【发布时间】:2016-12-08 19:38:47
【问题描述】:
当我使用其属性中定义的方法创建新交互时,我需要保留我的组件引用。举个例子:
在 DrawComponent.ts 中:
@Input() map:any;
layer:any;
// Filters functions
layerFilter(itemLayer:any) {
console.log(this)
return (itemLayer === this.layer);
};
// Init select interaction
select = new ol.interaction.Select({
layers: this.layerFilter
});
// Add select interaction to the map
this.map.addInteraction(this.select);
layerFilter 内的控制台日志返回 NULL,因为我丢失了组件引用。
你有解决办法或解释吗?
【问题讨论】:
标签: angular typescript openlayers-3