Answers for "ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'ngIf: false'. Current value: 'ngIf: true'."

7

angular ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked.

constructor(private ref: ChangeDetectorRef){}

  ngAfterContentChecked() {
    this.ref.detectChanges();
  }
Posted by: Guest on October-29-2020
1

ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'ngIf: [object Object]'. Current value: 'ngIf: true'.

// This type of error usually shows up beyond the initial development 
// stages, when we start to have some more expressions in our 
// templates, and we have typically started to use some of the 
// lifecycle hooks like AfterViewInit.
// below is the quick fix or workaround.

import { ChangeDetectorRef,AfterContentChecked} from '@angular/core'

export class example implements OnInit, AfterContentChecked {
    ngAfterContentChecked() : void {
        this.changeDetector.detectChanges();
    }
}

// for more detail about this type of error visit : 
// https://blog.angular-university.io/angular-debugging/
Posted by: Guest on November-19-2020

Code answers related to "ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'ngIf: false'. Current value: 'ngIf: true'."

Code answers related to "Javascript"

Browse Popular Code Answers by Language