1

I'm trying to build an authentication service for my angular2 app using FB Javascript SDK, however, the fact that the method FB.login (window.FB.login) is "out of the Zone" is breaking the "auto render thing" on my webapp. It happens because changes made as result of FB.login call don't update the view once they are "not monitored".

Right now, in order to make it work I'm manually defining the zone:

FB.login((response) => {
    this._ngZone.run(() => {
        ...
    }
}

however this isn't an "elegant solution" in my opinion.

Is there any other way to make it work [with FB Javascript SDK]?

dygufa
  • 186
  • 10
  • Have a look at this answer: http://stackoverflow.com/a/34593821/893630 – Michael Jun 26 '16 at 07:22
  • Hi @Michael, I'm already aware of that answer but I couldn't make it work in my case, maybe because `FB` is built on `window` (just guessing). Any thought on how to use dependency injection for FB SDK? – dygufa Jun 26 '16 at 07:28
  • Perhaps try calling `FB.init` within your FB provider factory – Michael Jun 26 '16 at 07:42

0 Answers0