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: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '[object Object]'. Current value: '2'.

See original GitHub issue

Sometimes I catching an exception:

LoadingBarComponent.html:2 ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '[object Object]'. Current value: '2'.
    at viewDebugError (core.es5.js:8433)
    at expressionChangedAfterItHasBeenCheckedError (core.es5.js:8411)
    at checkBindingNoChanges (core.es5.js:8575)
    at checkNoChangesNodeInline (core.es5.js:12416)
    at checkNoChangesNode (core.es5.js:12390)
    at debugCheckNoChangesNode (core.es5.js:13183)
    at debugCheckDirectivesFn (core.es5.js:13085)
    at Object.eval [as updateDirectives] (LoadingBarComponent.html:2)
    at Object.debugUpdateDirectives [as updateDirectives] (core.es5.js:13067)
    at checkNoChangesView (core.es5.js:12230)

  | View_LoadingBarComponent_0 | @ | LoadingBarComponent.html:2
-- | -- | -- | --
  | proxyClass | @ | compiler.es5.js:14985
  | webpackJsonp.../../../core/@angular/core.es5.js.DebugContext_.logError | @ | core.es5.js:13407
  | webpackJsonp.../../../core/@angular/core.es5.js.ErrorHandler.handleError | @ | core.es5.js:1080
  | (anonymous) | @ | core.es5.js:4819
  | webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke | @ | zone.js:392
  | webpackJsonp.../../../../zone.js/dist/zone.js.Zone.run | @ | zone.js:142
  | webpackJsonp.../../../core/@angular/core.es5.js.NgZone.runOutsideAngular | @ | core.es5.js:3844
  | webpackJsonp.../../../core/@angular/core.es5.js.ApplicationRef_.tick | @ | core.es5.js:4819
  | (anonymous) | @ | core.es5.js:4684
  | webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke | @ | zone.js:392
  | onInvoke | @ | core.es5.js:3890
  | webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invoke | @ | zone.js:391
  | webpackJsonp.../../../../zone.js/dist/zone.js.Zone.run | @ | zone.js:142
  | webpackJsonp.../../../core/@angular/core.es5.js.NgZone.run | @ | core.es5.js:3821
  | next | @ | core.es5.js:4684
  | schedulerFn | @ | core.es5.js:3635
  | webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.SafeSubscriber.__tryOrUnsub | @ | Subscriber.js:239
  | webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.SafeSubscriber.next | @ | Subscriber.js:186
  | webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber._next | @ | Subscriber.js:127
  | webpackJsonp.../../../../rxjs/_esm5/Subscriber.js.Subscriber.next | @ | Subscriber.js:91
  | webpackJsonp.../../../../rxjs/_esm5/Subject.js.Subject.next | @ | Subject.js:56
  | webpackJsonp.../../../core/@angular/core.es5.js.EventEmitter.emit | @ | core.es5.js:3621
  | checkStable | @ | core.es5.js:3855
  | onLeave | @ | core.es5.js:3934
  | onInvokeTask | @ | core.es5.js:3884
  | webpackJsonp.../../../../zone.js/dist/zone.js.ZoneDelegate.invokeTask | @ | zone.js:424
  | webpackJsonp.../../../../zone.js/dist/zone.js.Zone.runTask | @ | zone.js:192
  | webpackJsonp.../../../../zone.js/dist/zone.js.ZoneTask.invokeTask | @ | zone.js:499
  | invokeTask | @ | zone.js:1540
  | globalZoneAwareCallback | @ | zone.js:1566

My code

[package.json]
...
"dependencies": {
...
  "@ngx-loading-bar/http": "^1.0.0-alpha.16",
...
[app/app.module.ts]
// node_modules
import {BrowserModule} from '@angular/platform-browser';
import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
import {NgModule} from '@angular/core';
import {HttpModule} from '@angular/http';
import {Routes, RouterModule} from '@angular/router';
import {NgbModalModule} from '@ng-bootstrap/ng-bootstrap';
import { LoadingBarHttpModule } from '@ngx-loading-bar/http';
// AppComponent
import {AppComponent} from './app.component';

// Core
import {CoreModule} from './core/core.module';

// Features
import {LoginModule, ActivationModule, MainModule} from './features';

// Setup routes
const appRoutes: Routes = [
    {path: '**', redirectTo: '/'},
];

@NgModule({
    declarations: [
        AppComponent
    ],
    imports: [
        BrowserModule,
        BrowserAnimationsModule,
        HttpModule,
        LoadingBarHttpModule,
        RouterModule.forRoot(appRoutes),
        NgbModalModule.forRoot(),
        CoreModule,
        LoginModule,
        ActivationModule,
        MainModule
    ],
    bootstrap: [AppComponent]
})
export class AppModule {
}
[app/app.component.html]
<ngx-loading-bar></ngx-loading-bar>
<router-outlet></router-outlet>

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
aitboudadcommented, Nov 27, 2017

that’s great, I’m working on a fix right now!

0reactions
KSANTHOSHKUMAcommented, Dec 17, 2018

@aitboudad , your explanation is awesome, i am getting the same error, now it is solved with your explantation . VERY GREAT EXPLANATION FROM YOU , your knowledge is in very peak stage

Read more comments on GitHub >

github_iconTop Results From Across the Web

NG0100: Expression has changed after it was checked - Angular
Angular throws an ExpressionChangedAfterItHasBeenCheckedError when an expression value has been changed after change detection has completed.
Read more >
ExpressionChangedAfterItHasBe...
ERROR : ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value for 'mat-checkbox-checked': ...
Read more >
Angular Debugging "Expression has changed": Explanation ...
Learn a complete explanation about ExpressionChangedAfterItHasBeenCheckedError: why it occurs, how to troubleshoot it and how to fix it.
Read more >
Fixing "Expression has changed after it was checked" in Angular
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 >
Expression Has Changed After It Was Checked — Angular ...
Error : ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'A message for the child component'.
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