I'm trying to use a function to populate part of the contents of my popup, similar to the example shown here, but the function isn't being called--the popup just displays whatever field I attempt to pass to the function. My popup template code (very much simplified at this point, to determine if it's even being called) is shown below. I would expect the popup to contain the text "Put this in the popup " and the species field value, but all I'm seeing is the species field value. If I change 'species1' to another field in the content section, that field's value will be shown instead.
Any thoughts on what could be going wrong here would be much appreciated.
let getHeaderExpr = function(value,key,data){
let textStr = "Put this in the popup " + value;
return textStr;
};
let specimenPopup = new PopupTemplate({
title: "Species: {species1}",
content: "{species1:getHeaderExpr}"
});layer = new FeatureLayer({
url: layerPointsUrl,
visible: false,
renderer: specimenRenderer,
popupTemplate: specimenPopup
});