Hi I'm using Javascript api 4.X with Angular and am getting the subject error when I try to call the xyToLngLat method on webMercatorUtils. I'm using the esri-loader to load esri modules.
In the code below the PanMap method in the Map Component gets called from Component MtTicketListComponent. Any ideas where I'm going wrong?
Thanks
Pete
Component 1
export class MtTicketListComponent implements OnInit {
....
public mtMap:MtMapComponent = new MtMapComponent;
...
MarkTicket(ticketData:UnMarkedData) {
this.mtMap.PanMap(ticketData.ptCenterX, ticketData.ptCenterY);
}
}
Map Component
export class MtMapComponent implements OnInit {
...
utilsMerc: __esri.webMercatorUtils
ngOnInit(): void {
loadModules([
'esri/Map',
'esri/views/MapView',
'esri/geometry/support/webMercatorUtils'
])
.then(([EsriMap, EsriMapView, EsriwebMercatorUtils]) => {
this.utilsMerc = new EsriwebMercatorUtils;
...
...
})
...
}
public PanMap(x: number, y: number) {
let coordinates: any = this.utilsMerc.xyToLngLat(x,y);//getting undefined error on this.utilsMerc
..
}