I am using the ESRI JS 4.24 API to create a mapping application that pulls in a Map Image Layer that is hosted on ArcE Portal. I am having trouble getting attributes to show in my pop-up. I would like to display all attributes in the pop-up, not just a select few.
According to documentation the
outFields: ["*"]
has been replaced with
defaultPopupTemplateEnabled: true
However, I am getting no content in my pop-up at the moment. Here's what I'm looking at currently:
Here is my code currently, any suggestions are welcome!
require([
"esri/config",
"esri/WebMap",
"esri/views/MapView",
"esri/widgets/AreaMeasurement2D",
"esri/widgets/Compass",
"esri/widgets/Home",
"esri/widgets/LayerList",
"esri/widgets/ScaleBar",
"esri/widgets/Search",
"esri/widgets/BasemapToggle",
"esri/widgets/Legend",
"esri/widgets/Expand",
"esri/core/reactiveUtils",
"esri/widgets/Popup",
"esri/Map",
"esri/layers/MapImageLayer",
"esri/PopupTemplate",
], function (esriConfig, WebMap, MapView, AreaMeasurement2D,
Compass, Home, LayerList, ScaleBar, Search, BasemapToggle,
Legend, Expand, reactiveUtils, Popup, Map, MapImageLayer,
PopupTemplate) {
esriConfig.portalUrl = "PORTAL_URL";
const map = new Map({
basemap: "gray-vector"
});
const view = new MapView({
map: map,
container: "viewDiv",
center: [-95, 40],
zoom: 4,
});
let layer = new MapImageLayer({
portalItem: {
id: "1acc2c72f17f44b0bd47ca31f63c9a95",
},
});
map.add(layer);
layer.when(() => {
layer.allSublayers.forEach((sublayer) => {
sublayer.popupEnabled = true;
sublayer.popupTemplate = {
defaultPopupTemplateEnabled: true,
outFields: ["*"],
}
});
});