Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

255
Vistas
ArcGIS-JS-API - Custom Content in Popup Template is display nothing (Angular 11)

I want to display a hyperlink on the bottom of the popup template in arcgis esri map. I've added the code I've tried, but hyperlink is not displaying in the popup template. Only the fields table is displaying. Could you please have look into this code and let me know if I've missed something.

.ts file

const popUpTemplate = new PopupTemplate({
  title: "{name}",
  content: [
      {
          type: "fields",
          fieldInfos: [
              {
                  fieldName: "PhysicianName",
                  label: "Physician Name"
              },
              {
                  fieldName: "Practice",
                  label: "Primary Practise",

              },
          ]
      },
    new CustomContent({
      outFields: ["*"],
      creator: (graphic) => {
          const a = document.createElement("a");
          a.href = "https://www.youtube.com/";
          a.target = "_blank";
          a.innerText = graphic.attributes.PhysicianName;
          return a;
      }
  })
  ],
  outFields: ["*"]
});
   
    const myLayer = new FeatureLayer({
    source: physicianData.map((d,i)=>(
      {
          geometry: new Point({
            longitude: d.Longitude,
            latitude: d.Latitude
          }),
          attributes: {
            ObjectID: i,
            name : d.PhysicianName,
            PhysicianName : d.PhysicianName,
            Practice : d.Practice,
            ...d
          }
      }
    )),
    fields: [{
      name: "ObjectID",
      alias: "ObjectID",
      type: "oid"
    }, 
    {
      name: "name",
      alias: "Physician : ",
      type: "string"
    },
    {
      name: "PhysicianName",
      alias: "Physician Name",
      type: "string"
    },
    {
      name: "Practice",
      alias: "Practice",
      type: "string"
    },
   ],
  objectIdField: 'ObjectID',
  geometryType: "point",
  popupTemplate : popUpTemplate,
});

.html file

    <div #mapViewNode></div>
about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

I think your issue is that you need to define the fields of the layer.

If you are working with client side graphics and FeatureLayer, you need to set:

  • source, the collection of graphics (geometry + attributes)
  • objectIdField, the field that is going to identify the graphics, type oid (*)
  • fields, the name, alias, and type of each field of the graphics attributes

In your case, just by deducing the possible attributes, it should be something like this

const dataFeedLayer = new FeatureLayer({
    source: locationData.map((d,i)=>(
        {
            geometry: new Point({
                longitude: d.longitude,
                latitude: d.latitude
            }),
            attributes: {
                ObjectID: i,
                ...d
            }
        }
    )),
    objectIdField: 'ObjectID',
    popupTemplate : popUpTemplate,
    fields: [
        {
            name: "ObjectID",
            alias: "ID",
            type: "oid"
        },
        {
            name: "PhysicianName",
            alias: "Physician Name",
            type: "string"
        },
        {
            name: "PrimarySpecialty",
            alias: "Primary Specialty",
            type: "string"
        },
        {
            name: "url",
            alias: "Url",
            type: "string"
        }
    ]
});

When creating a FeatureLayer from client-side features, this property should be set in the constructor along with the source property. The objectId field also must be set either in this array or in the objectIdField property.

From ArcGIS JS API - FeatureLayer fields

about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda