From the course: Angular: Testing and Debugging

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Understanding zones in Angular apps

Understanding zones in Angular apps - Angular Tutorial

From the course: Angular: Testing and Debugging

Start my 1-month free trial

Understanding zones in Angular apps

- [Instructor] Angular executes all code inside of Zones. It does this using Zone.js which is now part of the angular core library. Zones are great for high-performance applications but they can cause cryptic error messages in the console and can be hard to diagnose. Understanding how Zones work will help you pinpoint the root cause of errors much more effectively. Frameworks like Angular use Zones to check that all business logic is complete before it updates the done. This ensures that done updates happen at the most efficient point in the rendering cycle. Zones work by creating a scope container that groups a chunk of code together even if that code executes asynchronously. These chunks are called execution contexts. There can be only one zone per stack and all code on a given stack executes in the same zone. Child zones can reference their parents and inherit properties but parent zones can not reference their children. Zones are immutable. They cannot be changed once created…

Contents