Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
stephane-dereppe opened this issue Dec 7, 2016 · 6 comments

Comments

@stephane-dereppe
Copy link

stephane-dereppe commented Dec 7, 2016

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]

@akserg
Copy link
Owner

akserg commented Feb 15, 2017

Hi @schtrym,

It the issue still exists?

@stephane-dereppe
Copy link
Author

I added

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

to avoid the error

@akserg
Copy link
Owner

akserg commented Feb 24, 2017

Can you, please create the PR?

@usmanatron
Copy link

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

@akserg
Copy link
Owner

akserg commented Mar 8, 2017

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

@JiahaoLi
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants