Here's the code demonstrating zone.js capabilities from here:
Zone.current.fork({}).run(function () {
Zone.current.inTheZone = true;
setTimeout(function () {
console.log('in the zone: ' + !!Zone.current.inTheZone);
}, 0);
});
console.log('in the zone: ' + !!Zone.current.inTheZone);
The above will log:
'in the zone: false'
'in the zone: true'
I don't really understand what is it that zone is doing here and how's it related to intercepting events that this video talks about.
It outputs false
the first time because Zone.current.inTheZone
is undefined
, and since we changed Zone.current.inTheZone = true;
that is the value now that is ouputted second time. What's special is zone
doing here?