Join the Stack Overflow Community
Stack Overflow is a community of 6.8 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

After the response, I want to call angular function from outside js and it seems so surprise to me as this function throws an error

  function _i(){
     FB.api('/me', function(response) {
    angular.element(document.getElementById('vikas_facebook')).scope().connectWithFacebook(response);
    });
 }

AngularJs Function

$scope.connectWithFacebook = function (response) {

   // Saving response data in our database

}

I have used this function many times and it worked perfectly but in fb.api It throws an error. PFA regarding thisenter image description here

share|improve this question
    
Seems like a script isn't getting loaded correctly if it really does work everywhere else – Trevor Hart 48 mins ago
    
Does document.getElementById('vikas_facebook') element exist when you are trying to get scope – Satpal 48 mins ago

I don't know what happen in your code but your code should be work. but this type of function calling not good practice. So you can follow below link for avoid this problem too Facebook SDK for JavaScript with AngularJS

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.