In openlayers 5 I have a vector layer and I try to create code to get the properties of a feature after it is clicked.
This is my code so far
var selectClick = new Select({
condition: click,
layers:this.vectorlayer
});
this.olmap.addInteraction(selectClick);
var selectedFeatures = selectClick.getFeatures();
and then I have tried
selectClick.on('select', ()=>{console.log(selectedFeatures);});
and
selectedFeatures.on('add', function(event) {
console.log( selectClick.getFeatures());
});
and I get
ERROR TypeError: arr.indexOf is not a function
in both cases.
What am I doing wrong? My ultimate goal is to do something like
selectClick.getFeatures().feature.properties.id
, since the geoJSON I am loading, also has some metadata properties in it.
So, how can I get the selected feature ?
Thanks