It turns out that the esri/widgets/Feature class is what I needed.
And here's some example code using it in an AngularJS context:
function onLayerChanged(layer, esri) {
var fieldInfos;
if (layer.popupInfo) {
fieldInfos = _.map(layer.popupInfo.fieldInfos,
function (fieldInfo) {
if (fieldInfo.format && fieldInfo.format.dateFormat) {
// Transform any old dateFormat values to new equivalent e.g. "dayShortMonthYear" becomes "day-short-month-year"
fieldInfo.format.dateFormat = getDateFormat(fieldInfo.format.dateFormat);
}
return fieldInfo;
});
}
_graphic = new esri.Graphic({ // esri/Graphic
popupTemplate: {
content: layer.popupInfo ? layer.popupInfo.description : '',
fieldInfos: fieldInfos
}
});
}
function onFeaturesChanged(features, esri) {
_this.parsedFeatures.length = 0;
_this.parsedFeatures = _.map(features,
function (feature) {
var div = document.createElement('div');
_graphic.attributes = feature.attributes;
var featureWidget = new esri.Feature({ // esri/widgets/Feature
graphic: _graphic,
container: div
});
featureWidget.renderNow();
return {
id: feature.uid,
html: div.outerHTML
};
});
}
function getDateFormat(dateFormat) {
// Swap any older style dateFormats for newer version
switch (dateFormat) {
case 'shortDate':
return 'short-date';
break;
case 'shortDateLE':
return 'short-date-le';
break;
case 'longMonthDayYear':
return 'long-month-day-year';
break;
case 'dayShortMonthYear':
return 'day-short-month-year';
break;
case 'longDate':
return 'long-date';
break;
case 'shortDateLongTime':
return 'short-date-long-time';
break;
case 'shortDateLELongTime':
return 'short-date-le-long-time';
break;
case 'shortDateShortTime':
return 'short-date-short-time';
break;
case 'shortDateLEShortTime':
return 'short-date-le-short-time';
break;
case 'shortDateShortTime24':
return 'short-date-short-time-24';
break;
case 'shortDateLEShortTime24':
return 'short-date-le-short-time-24';
break;
case 'shortDateShortTime24':
return 'short-date-short-time-24';
break;
case 'shortDateLEShortTime24':
return 'short-date-le-short-time-24';
break;
case 'longMonthYear':
return 'long-month-year';
break;
case 'shortMonthYear':
return 'short-month-year';
break;
case 'year':
return 'year';
break;
default:
return dateFormat;
}
}
In the code sample, I'm generating the html for each feature and storing it in _this.parsedFeatures
.