ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked.

  Time: May 8, 2021 14:22:35

ERROR Error: NG0100: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'true'. Current value: 'false'.. Find more at https://angular.io/errors/NG0100
    at throwErrorIfNoChangesMode (core.js:6792)
    at bindingUpdated (core.js:12940)
    at Module.ɵɵproperty (core.js:14740)
    at InvoiceManagementComponent_Template (invoice-management.component.html:55)
    at executeTemplate (core.js:9600)
    at refreshView (core.js:9466)
    at refreshComponent (core.js:10637)
    at refreshChildComponents (core.js:9263)
    at refreshView (core.js:9516)
    at refreshEmbeddedViews (core.js:10591)

The meaning of the problem is that once the page is rendered, don’t change it. If you change it again, I will report you an error. And that’s it.

Solution: add a line of code to the ngafterviewinit() method

  ngAfterViewInit(): void {
    this.changeDetectorRef.detectChanges();
  }

This only needs to be declared in the constructor

  constructor(
    public changeDetectorRef: ChangeDetectorRef
  ) { }

 

Read More: