Skip to content

Instantly share code, notes, and snippets.

@AregSargsyan
Last active June 1, 2020 12:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AregSargsyan/bf5aa510cc92d30be2b2ad01240804a7 to your computer and use it in GitHub Desktop.
Save AregSargsyan/bf5aa510cc92d30be2b2ad01240804a7 to your computer and use it in GitHub Desktop.
these event will not trigger change detection
@Component({
template: `...`,
changeDetection: ChangeDetectionStrategy.OnPush
})
export class CounterComponent {
count = 0;
constructor() {
setTimeout(() => this.count ++, 0);
setInterval(() => this.count ++, 100);
Promise.resolve().then(() => this.count = 10);
this.http.get('https://count.com').subscribe(res => {
this.count = res;
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment