I try to understand the folowing error :
TypeError: Cannot read properties of null (reading 'targetGeometry')
in my code.
I just define a featurelayer :
const secteur = new FeatureLayer({
title:"Secteurs des collèges",
definitionExpression: expr,
popupTemplate: popup,
labelingInfo: [labelClass]
});
map.add(secteur);
secteur.when(() => {
zoomToLayer(secteur);
});
and this function :
function zoomToLayer(layer) {
return layer.queryExtent().then((response) => {
view.goTo(response.extent)
});
}
The definition expression retrieves a single polygon in the view without zooming on it.
Where have I to define a target geometry ?
Thank's for some help