--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/sEFZ05vMkPMJ.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.
nice!I would recommend some changes, see: http://jsfiddle.net/IgorMinar/Hxbqd/5/especially using $apply in your service instead of $digest in the controller is quite important.cheers,
Igor
On Wed, Mar 28, 2012 at 1:45 PM, Mykhailo Kotsur <mic...@gmail.com> wrote:
Hola!I'm writing an app which heavily communicates with facebook thru their JS SDK and I thought it may be good to give a basic example for everybody who interested.So, here you have:
- Authorization with standard dialog and user data retrieval (http://jsfiddle.net/mkotsur/Hxbqd/)
- Test for controller (http://jsfiddle.net/mkotsur/49B7P/)
Mike
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/sEFZ05vMkPMJ.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/k8jFd2rd2J0J.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
It would seem to me you would be better just wrapping the whole response handler to the FB.login call in a $apply call: http://jsfiddle.net/Hxbqd/6/
By the way, this blows up if you try to run it a second time when you are already logged in, I suspect because in this case the response handler is executed immediately in the same call stack as call to askFacebookForAuthentication, which means that $apply has already been called. This is a tricky situation where the FB api is not consistent - i.e. if the user is already logged in then the response handler is called synchronously (inside the current $apply) but if otherwise it calls it asynchronously (without a $apply wrapper).Thinking aloud: I thought we could get around this by $defering the execution of the call but it doesn't like it.
Pete
Igor
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/k8jFd2rd2J0J.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.