Execution Context is an abstract concept that holds information about the environment within the current code being executed. A zone provides an execution context that persists across asynchronous operations is called as zone context. For example, the zone context will be same in both outside and inside setTimeout callback function:
1 2 3 4 5 6 7 8 | zone.run(() => { // outside zone expect(zoneThis).toBe(zone); setTimeout(function() { // the same outside zone exist here expect(zoneThis).toBe(zone); }); }); |
The current zone is retrieved through Zone.current.
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.