Hi,
I am new to ESRI and this library helped me load my map and do my click events. But, I have run into a situation where I am to load a Dynamic layer.
My code changes to Support it :
-
Modify load.ts file to load the dependency. '/esri/DynamicLayer'
-
I tried to add this layer in the MapService and am getting an exception as shown below :
Map service Code :
import { Injectable } from '@angular/core';
import Map from 'esri/Map';
import FeatureLayer from 'esri/layers/FeatureLayer';
import GraphicsLayer from 'esri/layers/GraphicsLayer';
import DynamicLayer from 'esri/layers/DynamicLayer';
@Injectable()
export class MapService {
map: any = null;
constructor() {
this.map = new Map({
basemap: 'dark-gray-vector',
ground: 'world-elevation',
layers: [
new DynamicLayer({
url: 'http://:6080/arcgis/rest/services/LIVE_PUBLIC/MapServer',
id: 'dynamic'
//intialExtent: [-90.74357428329998, 34.07762761854514, -81.21343491069999, 38.4992983226478]
}),
new FeatureLayer({
url: 'http://:6080/arcgis/rest/services/LIVE_PUBLIC/MapServer',
id: '0'
})
]
});
}
}
Exception :
TypeError: Cannot read property 'on' of undefined
at Object.set (js.arcgis.com/4.3/esri/layers/support/ExportImageParameters.js:6)
at c.set (js.arcgis.com/4.3/init.js:228)
at Object.set [as layer] (js.arcgis.com/4.3/init.js:317)
at m (js.arcgis.com/4.3/init.js:300)
at Object.m (js.arcgis.com/4.3/init.js:300)
at Object.set (js.arcgis.com/4.3/init.js:209)
at Object.postscript (js.arcgis.com/4.3/init.js:208)
at new (js.arcgis.com/4.3/init.js:219)
at Object.a.attach (js.arcgis.com/4.3/esri/views/2d/layers/MapImageLayerView2D.js:5)
at a._attachLayerView (js.arcgis.com/4.3/esri/views/MapView.js:28)
at Object.update (js.arcgis.com/4.3/esri/views/MapView.js:26)
at h._animationFrame (js.arcgis.com/4.3/init.js:332)
at ZoneDelegate.invokeTask (zone.js:367)
at Object.onInvokeTask (:3000/node_modules/@angular/core/bundles/core.umd.js:3971)
at ZoneDelegate.invokeTask (zone.js:366)
I am stuck with this for a few days now. Any help would be great !