Sorry for my bad english. Every time I run the project, this error always appears, and when I refresh the page, it disappears. It's very annoying because every time it happens, I have to continuously refresh the page.
here is my code in Search:
view.when(() => {
const searchWidget = new Search({
view: view,
sources: [
{
layer: fl,
searchFields: ["Name", "Address"],
name: "Search",
zoomScale: 10000,
},
],
includeDefaultSources: false,
allPlaceholder: "Tìm kiếm địa điểm",
});const expandSearch = new Expand({
view: view,
content: searchWidget,
expandTooltip: "Search",
});
view.ui.add(expandSearch, {
position: "top-left",
});
I will be grateful for any help you can provide.
If you can provide a sample in codepen or similar, it would help. Could be the layer, but no way to tell.
Here is my code look like: https://codepen.io/nhannt2909/pen/dyjEEoW
There is a lot going on in that sample, but if I had to guess, it's because you are calling the result of your ajax request "fl", and calling the FeatureLayer "fl", shadowing the variables. That's just a guess, the sample doesn't run as-is due to some other issues.
I guess the same as you. Is there any way to fix that error?