akserg/ng2-slim-loading-bar

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

Opened this issue · 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]

Hi @schtrym,

It the issue still exists?

I added

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

to avoid the error

Can you, please create the PR?

@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?

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

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.