Steve,
The city name not showing up in the popup is because I forgot to specify the outFields of the feature layer:
var fl = new FeatureLayer(url, {
id: "Cities",
infoTemplate: template,
outFields: ["CITY_NAME"]
});
You could change the symbology on the layer in Desktop and re-publish as you said or you just use setRenderer on the FeatureLayer.
require([
"dojo/dom-construct",
"esri/map",
"esri/layers/FeatureLayer",
"esri/geometry/Extent",
"esri/InfoTemplate",
"esri/renderers/SimpleRenderer",
"esri/symbols/SimpleMarkerSymbol",
"esri/Color",
"dojo/domReady!"
], function(
domConstruct,
Map,
FeatureLayer,
Extent,
InfoTemplate,
SimpleRenderer,
SimpleMarkerSymbol,
Color
) {
var bounds = new Extent({
"xmin":-16045622,
"ymin":-811556,
"xmax":7297718,
"ymax":11142818,
"spatialReference":{"wkid":102100}
});
var map = new Map("map", {
extent: bounds
});
var url = "http://services3.arcgis.com/HVjI8GKrRtjcQ4Ry/arcgis/rest/services/Major_World_Cities/FeatureServer/0";
var template = new InfoTemplate("Cities", "City: ${CITY_NAME}");
var fl = new FeatureLayer(url, {
id: "Cities",
infoTemplate: template,
outFields: ["*"]
});
var sms = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_SQUARE, 10, null, new Color([0,255,0,0.25]));
fl.setRenderer(new SimpleRenderer(sms));
map.addLayer(fl);
}