angularzonemicro-frontend

ERROR: Expected to not be in Angular Zone, but it is


I was trying to build a demo by using Angular and single-spa to see whether this could be our future path of development. Here is the example I tried to borrow from.

https://github.com/PlaceMe-SAS/single-spa-angular-cli-examples

However, I found when routing to another application, for example: click on Open Help or App1, the console will have errors like "ERROR: Expected to not be in Angular Zone, but it is!"

I did some research on internet trying to fix this error. However, I didn't found solution. I also submited an issue to the project. I'm just wondering whether anyone knows anything about this error here.

Thank you in advance!

enter image description here


Solution

  • I want to post our solution here. One of our developers solved this zone error by calling zone in each index.html. So in the portal main.js, remove the zone import and call zone from index.html

    index.html

    <body>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/zone.js/0.8.19/zone.js"></script>
        <script src="/build/common.js"></script>
        <script src="/build/main.js"></script>
    </body>