i want to avoid change detection, i tried one method but i want to use outside of angular concept
plunkr sample *this link has my plunkr sample , i tried one method to avoid change detection which creating micro task *
onClick() {
this.num++;
this.cdRef.detach();
this.ngZone.onMicrotaskEmpty.first().subscribe(() => {
this.cdRef.reattach();
});
}
i refered this question but i could not find my sollution relative question
onClick() {
debugger
this._ngZone.runOutsideAngular(() => {
// this.num++
setTimeout(()=>this.num = 5);
});
}
i used this code instead of using microtask method, it works fine