ng2-slim-loading-bar icon indicating copy to clipboard operation
ng2-slim-loading-bar copied to clipboard

Expression has changed after it was checked. Previous value: '0'. Current value: '1'.

Open stephane-dereppe opened this issue 9 years ago • 6 comments

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

Sometimes, an exception is raised after starting the loading bar :

Exception raised : zone.js:140 Uncaught Error: Error in ./SlimLoadingBarComponent class SlimLoadingBarComponent - inline template:3:32 caused by: Expression has changed after it was checked. Previous value: '0'. Current value: '1'.

It is not in each case and I really don't know what can trigger this error.

I have to add that as said here I do not have the problem when is enable Prod Mode...

But in dev mode (local dev), I get this errors.

Expected/desired behavior

No error.

Reproduction of the problem If the current behavior is a bug or you can illustrate your feature request better with an example, please provide the steps to reproduce and if possible a minimal demo of the problem via https://plnkr.co or similar.

What is the expected behavior?

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

Please tell us about your environment:

  • ng2-slim-loading-bar version: 2.0.5

  • Angular version: 2.0.2

  • Browser: [all]

  • Language: [TypeScript 2.0.2]

stephane-dereppe avatar Dec 07 '16 13:12 stephane-dereppe

Hi @schtrym,

It the issue still exists?

akserg avatar Feb 15 '17 13:02 akserg

I added

   ngAfterViewInit() {
       this._loadingBarService.loadingBarEvent.subscribe(bool => {
           this.visible = bool;
           this._changeDetectorRef.detectChanges();
       });
   };

to avoid the error

stephane-dereppe avatar Feb 20 '17 09:02 stephane-dereppe

Can you, please create the PR?

akserg avatar Feb 24 '17 13:02 akserg

@schtrym can you please give a bit more context regarding where you put this? I'm happy to make the changes and send a PR (this is causing me loads of problems!) if you're happy for me to do so?

usmanatron avatar Mar 03 '17 14:03 usmanatron

Hi @schtrym I have created PR to fix your issue. Can you, please have a look?

akserg avatar Mar 08 '17 00:03 akserg

Have the same issue. After making couple of tries, I found to add resolve in routing for view page can avoid this issue. And also wait for PR for this issue.

JiahaoLi avatar Jul 21 '17 15:07 JiahaoLi