After some moments of deep concentration I came up with something like this.class FacebookServiceconstructor : (@$rootScope, @$log) ->returnbroadcast : (name, response) ->@$rootScope.$broadcast 'facebookEvent',name : nameresponse : responseclass FacebookSdkDirectiveconstructor : (@facebookService, @$window) ->@restrict = 'E'@template = '<div id="fb-root"></div>'@replace = true@$window.fbAsyncInit = =>FB.Event.subscribe 'auth.login', (response) =>@facebookService.broadcast('auth.login', response)FB.initappId : '...' # App IDstatus : true # check login statuscookie : true # enable cookies to allow the server to access the sessionxfbml : true # parse XFBMLAfterwards you are able to access the facebook events through $scope:$scope.$on 'facebookEvent', (e, data) ->...Best regardsChristian
It's actually CoffeeScript, a language that compiles into JavaScript: coffeescript.org. It's not necessary for any of this, but a lot of people like those additional constructs they feel are missing from JavaScript.
Josh
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en-US.