Hi,
I'm unable to import dojo/_base/lang in my angular component. Is there any specific steps to do it.
I actually want to use lang.hitch to make it work for this issue Unable to access zoom level outside watchUtils.watch in ESRI
Thanks in advance!
You don't need lang.hitch for this and we don't really recommend you use dojo libs for 4x development.
You have a couple of options here.
// fat arrow functions will use scope of parent
watchUtils.watch(this.mapView, "zoom", (zoom) => {
this.zoomLevel = zoom;
});
// use native Function.bind()
watchUtils.watch(this.mapView, "zoom", (function(zoom) {
this.zoomLevel = zoom;
}).bind(this));
Since you're using Angular, I assume you're using TypeScript, so fat arrow functions would be the best solution in that case.