How to run angular change detection manually ?

Anil Kumar
Mar 3, 2024

--

By injecting change detector ref in constructor then calling function detectChanges();

.

import { ChangeDetectorRef } from '@angular/core'; 
constructor( private cd: ChangeDetectorRef){

}

checkTheData(){
this.cd.detectChanges();
//this.cd.markForCheck()
}

--

--