Skip to content

Binding value didn't update after asynchronous change  #16343

@montylab

Description

@montylab

I'm submitting a

[x] bug report => search github for a similar issue or PR before submitting

I saw similar issue here: #7381
But it doesn't helped me, since current angular version isn't using babel

Current behavior
After asynchronous function is called, variable changes to true, but *ngIf doesn't showing up the item
After 5-30 seconds it detect variable change and showing item

Expected behavior
After asynchronous function is called, variable changes to true => *ngIf should showing up the item instantly

Minimal reproduction of the problem with instructions

https://angular-binding-bug.firebaseapp.com/ - demo

  1. open console
  2. try to sign in using google
  3. see that username doesn't appear, but console output showed correct results

https://github.com/montylab/angular2_cd_bug

<li *ngIf="isAuth" class="user"> 
    {{username}}
...

LI doesn't showing up after isAuth changed to true

this.authService.onAuthStateChange.subscribe((isAuth) => {
	this.username = this.authService.getUsername();
	this.isAuth = isAuth;
	console.log('fires subject - ', 'isAuth: ' + isAuth, 'name: '+ this.username);
	console.log('context: ', this);
});

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

Please tell us about your environment:

Windows 10, PHP Storm, npm, ng cli serve

  • Angular version: 4.0.3
  • Browser: Chrome (sometimes it works, try incognito mode), probably all.
  • Language: Typescript 2.2.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: coreIssues related to the framework runtime

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions