Displaying popup on arcGIS map

Viewed 114

I have a lists of location and if the user click it will location and display its details in popup, in my current behavior if i click the location in the lists, it will locate it and popup will appear. the problem is that the popup no detail display or text displayed

const onLocationSelect = (location) => {
         let locationGraphics = [];
         let point = new Graphic({
         attributes: {
                 city: location.address.city,
                 name: location.name,
                 state: location.address.state,
                 street1: location.address.street1,
                 street2: location.address.street2,
                 zipCode: location.address.zipCode,
        },
    });
    location.point = point;
    locationGraphics.push(point);
    const result = LocationLayer.applyEdits({
              addFeatures: locationGraphics,
     }).then((results) => {
     if (results) {
           mapDiv.current.goTo(location).then(() => {
           mapDiv.current.popup.open({
                   features:location,
                   location:[
                             location.geoCode.longitude,
                             location.geoCode.latitude,
                   ]
           })
       })
       }
    });
  }

resource

https://developers.arcgis.com/javascript/latest/sample-code/featurelayer-query-pagination/

1 Answers

do this,

point.popupTemplate = {
  content: [{
    type: "text", // Autocasts as new TextContent
    text: "The {expression/predominance-tree} species occurs more often"
      + " than other tree species in the area."
  }]
};

then

features:[point]

Related