Hello I have an issue with a compass widget, the issue is that even though I rotate the map and the click on the compass it doesn't rotate back so that north is up. This is my code:
(my typescript):
I click on the compass but nothing happens, any idea why?
Solved! Go to Solution.
I have a TODO to clarify these steps on the jsapi-resources repo. Here they are in case you missed something. Note, I verified these steps on Angular 17, since we only test against the latest production version of frameworks.
Create src/zone-flags.ts file, and then add this:
(window as any).__zone_symbol__UNPATCHED_EVENTS = ['click'];
In angular.json, make this adjustment:
"polyfills": [
"src/zone-flags",
"zone.js"
],
In tsconfig.app.json make this adjustment:
"files": [
"src/zone-flags.ts",
"src/main.ts"
],
Thanks for reporting, I am able to repro on 4.28 and 4.29-next. We'll take a closer look.
This appears to be related to a known issue with Calcite: https://github.com/Esri/jsapi-resources/tree/main/esm-samples/jsapi-angular-cli#known-issues. Try disabling the zone.js monkey patching for click events. Here's a diff that shows what you need to do https://github.com/Esri/jsapi-resources/issues/481#issuecomment-1687048980.
If I understood correctly I need to add "src/zone-flags.js" to angular.json in polyfills before zone.js and this is how it looks for me:
but the compass is still not working as expected did I miss something?
I have a TODO to clarify these steps on the jsapi-resources repo. Here they are in case you missed something. Note, I verified these steps on Angular 17, since we only test against the latest production version of frameworks.
Create src/zone-flags.ts file, and then add this:
(window as any).__zone_symbol__UNPATCHED_EVENTS = ['click'];
In angular.json, make this adjustment:
"polyfills": [
"src/zone-flags",
"zone.js"
],
In tsconfig.app.json make this adjustment:
"files": [
"src/zone-flags.ts",
"src/main.ts"
],
Thank you 🙂
The Angular bug has been fixed in zone.js version 0.14.5. We recommend updating zone.js if you are having issues with the SDK's widgets. https://github.com/Esri/jsapi-resources/tree/main/esm-samples/jsapi-angular-cli#known-issues