angular2-social-login icon indicating copy to clipboard operation
angular2-social-login copied to clipboard

FB.api() breaks Angular change detection

Open ssljivic opened this issue 7 years ago • 0 comments
trafficstars

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

ssljivic avatar Feb 19 '18 22:02 ssljivic