Okay, you should be able to manually query the feature service for graphics (which will include attributes).
I would load all features when the page loads and then query against those features based on the user input later. Revised sample:
let featureLayer = new FeatureLayer({
url: <FeatureLayer URL>,
outFields: ["*"]
});
let allPolygons = [];
featureLayer.load().then(fl => {
featureLayer.queryFeatures().then(results => {
allPolygons = results.features;
});
});
function findPolygons(searchPolygon, graphics){
if (graphics.length === 0) return [];
return graphics.filter(graphic => geometryEngine.intersects(graphic.geometry, searchPolygon));
}
I should mention that if the graphics returned by the manual query don't have attributes, you may have to pass in a Query to queryFeatures. The query needs a .where of "1=1" and an outFields of "*." Let me know if you run into difficulties with that.