question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Expression has changed after it was checked. Previous value: 'true'. Current value: 'false'.

See original GitHub issue

I keep getting this error. In my component I have this:

  ngOnInit() {
    setTimeout(() => {
      this.formOptions = this.formData.get(["categories"])
    }, 0)
  }

And this is in my template:

ng-select([options]="(formOptions | async)?.categories", [multiple]="true", [allowClear]="true", formControlName="sourceCategories")

I have nailed it down to being a problem with ng-select since it goes away once I remove it from my template.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Comments:12 (2 by maintainers)

github_iconTop GitHub Comments

13reactions
gieboyzcommented, Sep 5, 2017

Hi you can add this

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

       public ngDoCheck() {
		this.cdRef.detectChanges();
	}
1reaction
swapswordcommented, Mar 1, 2018

@gieboyz No a good idea to put it inside ngDoCheck function. As, it will start infinite change detection loop.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Expression ___ has changed after it was checked
This error is coming because existing value is getting updated immediately after getting initialized. So if you will update new value after existing...
Read more >
NG0100: Expression has changed after it was checked
Angular throws an ExpressionChangedAfterItHasBeenCheckedError when an expression value has been changed after change detection has completed.
Read more >
Angular Debugging "Expression has changed"
Learn a complete explanation about ExpressionChangedAfterItHasBeenCheckedError: why it occurs, how to troubleshoot it and how to fix it.
Read more >
Expression Has Changed After It Was Checked — Angular ...
I will give an explanation and a solution to the issue. Hope it will be helpful for you. Usually such questions (like, Previous...
Read more >
Fixing "Expression has changed after it was checked" in ...
The exception appears (in the development mode) at the moment the value is checked and value is different of the updated value. Error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found