akserg / ng2-slim-loading-bar

Angular 2 component shows slim loading bar at the top of the page.
MIT License
358 stars 93 forks source link

ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '0%'. Current value: '15%'. #48

Open TautvydasDerzinskas opened 7 years ago

TautvydasDerzinskas commented 7 years ago

I'm submitting a ... (check one with "x")

[X ] bug report => check the FAQ and search github for a similar issue or PR before submitting
[ ] support request => check the FAQ and search github for a similar issue before submitting
[ ] feature request

Current behavior Loading bar is triggered and everything is pretty nice, except the fact I'm getting this exception in the console: SlimLoadingBarComponent.html:3 ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '0%'. Current value: '15%'. at viewDebugError (core.es5.js:8633) at expressionChangedAfterItHasBeenCheckedError (core.es5.js:8611) at checkBindingNoChanges (core.es5.js:8775) at checkNoChangesNodeInline (core.es5.js:12329) at checkNoChangesNode (core.es5.js:12303) at debugCheckNoChangesNode (core.es5.js:12922) at debugCheckRenderNodeFn (core.es5.js:12862) at Object.eval [as updateRenderer] (SlimLoadingBarComponent.html:3) at Object.debugUpdateRenderer [as updateRenderer] (core.es5.js:12844) at checkNoChangesView (core.es5.js:12125) at callViewAction (core.es5.js:12487)

It happens only in one case in my app, sadly I can't even try reproduce it, as it's huge private logic...

Expected/desired behavior No exceptions when triggering loadig-bar at all times.

Reproduction of the problem

What is the expected behavior?

What is the motivation / use case for changing the behavior?

Please tell us about your environment: angular-cli setup

akserg commented 7 years ago

Hi @SlimDogs ,

Can you share a bit more information about your environment like webpack/systemjs, code snippets etc?

TautvydasDerzinskas commented 7 years ago

Hey, well it's too complex. It wasn't the issue with the plugin itself - it's issue with the architecture... To resolve this I recommend to use setTimeout(() => { ng-slim-loading-bar update logic goes here });

werts commented 7 years ago

@SlimDogs Your advise seems not working for me, i get the error again.I try to close the slim-bar after child component created.So i face the same error.

reinaldoferreira commented 7 years ago

I'm also facing the same problem... Yes, if I add setTimeout() it fixes the issue but that shouldn't be the best solution. :(