Closed z3dmax closed 6 years ago
@z3dmax
The below example shows how you could create a feature layer that includes a configured popupTemplate. All that you would need to do at this point is add graphics to the feature layer that have attributes to map to the fields in the feature layer.
this.esriLoader
.loadModules([
'esri/layers/FeatureLayer',
'esri/PopupTemplate',
'esri/core/Collection',
'esri/geometry/Point',
'esri/renderers/SimpleRenderer',
'esri/symbols/PictureMarkerSymbol'
])
.then((FeatureLayer, PopupTemplate, Collection, Point, SimpleRenderer, PictureMarkerSymbol) => {
const featureLayer = new FeatureLayer({
fields: [
{
name: 'ObjectID',
alias: 'ObjectID',
type: 'oid'
},
{
name: 'title',
alias: 'title',
type: 'string'
},
{
name: 'place',
alias: 'place',
type: 'string'
}
],
objectIdField: 'ObjectID',
spatialReference: {
wkid: 4326
},
geometryType: 'point',
popupTemplate: new PopupTemplate({
title: '{title}',
content: '{place}'
}),
title: layer.name,
id: layer.id,
source: new Collection(),
renderer: new SimpleRenderer({
symbol: new PictureMarkerSymbol({
url: 'url/of/some/icon',
width: 18,
height: 18
})
})
});
this.map.add(featureLayer);
});
@z3dmax I had forgotten about an example that I put together recently that shows putting a graphic on a map that includes a popup. Take a look at this.
Hi, is it possible to show a popup or window box or something similar using this library? Is there any example? I've an Angular5 running project with everything right except popups.
Here original InfoTemplate Esri example: