Skip to content

FB.api() breaks Angular change detection #32

@ssljivic

Description

@ssljivic

It seems that FB.api() adds a script to the page and executes a callback (which eventually executes your callback). Since this added script is run outside the Angular zone, you callback is too, which makes changes not visible to Angular.

To fix this, can you please add ngZone.run() wrapper like so:

FB.api('/me', () => {
  // This is run outside the Angular zone. We need to get back in.
  this.ngZone.run(() => {
    ... your code ...
  });
});

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions