Skip to content

Misleading change detection source.  #51453

@JeanMeche

Description

@JeanMeche

Is this a bug report or a feature request?

  • Bug Report
  • Feature Request

Please provide the steps to reproduce the issue [Bug Report only]

Suppose I have this demo code :

this.zone.runOutsideAngular(() => {
  document.getElementsByTagName('button')[0].addEventListener('click', () => {
      this.zone.run(() =>   this.name += ' test');
  });
});

The devTools will report that the change detection source is HTMLButtonElement.addEventListener:click

or

this.zone.runOutsideAngular(() => {
  window.setTimeout(() => {
    this.zone.run(() => this.name += ' test');
  }, 3000);
})

Here the devTools report setTimeout as the source.

I find this a bit misleading since addEventListener/setTimeout are called outside the angular zone and it's the zone.run that is responsible for calling the change detection.

This thing happens with

WDYT ?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions