After revamping an old Angular 1.x website, I've hit a roadblock when converting a section of the code.
Original Code:
var loaded = vm.cartMap.on('load', function() {
loaded.remove();
setupExtentLayer();
});
function setupExtentLayer() {
esriLoader.require(['esri/layers/GraphicsLayer'], function (GraphicsLayer) {
vm.extentLayer = new GraphicsLayer();
vm.cartMap.addLayer(vm.extentLayer);
if (vm.cartItems.length > 0) {
_updateCartStatus();
}
});
}
New Code:
const loaded = this.cartMap.on('load', function() {
loaded.remove();
this.setupExtentLayer();
});
setupExtentLayer() {
loadModules(['esri/layers/GraphicsLayer']).then(([GraphicLayer]) => {
this.extentLayer = new GraphicLayer();
this.cartMap.addLayer(this.extentLayer);
if (this.cartItems.length > 0) {
this._updateCartStatus();
}
});
}
I encountered an issue where the angular 2.6 code does not recognize the method setupExtentLayer().
What could be causing this discrepancy?