I have the following code that defines my feature layers, but I would like to evaluate the layer name to ensure that the numbered layer is the correct feature that I am referencing on the chance layers are added. How would I do this?
var initialExtent = new Extent({
"xmin": 777229.03,
"ymin": 1133467.92,
"xmax": 848340.14,
"ymax": 1185634.58,
"spatialReference": {
"wkid": 3435
}
});
// app configuration
var config = {
mapOptions: {
showAttribution: false,
sliderStyle: "small",
extent: initialExtent,
logo: false,
sliderPosition: "bottom-right"
},
signLayerUrl: "http://maps.decaturil.gov/arcgis/rest/services/test/StreetSignTest/FeatureServer/0",
supportLayerUrl: "http://maps.decaturil.gov/arcgis/rest/services/test/StreetSignTest/FeatureServer/1"
};I tried doing the following:
var featureService = new FeatureLayer("http://maps.decaturil.gov/arcgis/rest/services/test/StreetSignTest/FeatureServer");alert(featureService.LayerInfo[0].name);
And receive the following error:
ypeError: Cannot read property '0' of undefined
"in domReady callback"
"TypeError: Cannot read property '0' of undefined
I thought that this would provide me with the name of the first layer, but I am receiving an error instead. How should I write this?
And I referenced this, but there are no examples: LayerInfo | API Reference | ArcGIS API for JavaScript