1

I have a basic angular app with one controller. Now, i am creating a signin with g+ button like this

(function() {
  var po = document.createElement('script');
  po.type = 'text/javascript'; po.async = true;
  po.src = 'https://apis.google.com/js/client:plusone.js?onload=renderSignin';
  var s = document.getElementsByTagName('script')[0];
  s.parentNode.insertBefore(po, s);
})();

the function 'renderSignin' is defined in my controller as follows

$scope.renderSignin = function() { ... }

But it looks like it can't be found. I also tried {{renderSignin}}, but it didn't work either Is there something i have to do to get it to work? Thanks.

3
  • 1
    I dont see any angular controller code here.. can you add some more context? Commented Dec 31, 2013 at 16:46
  • And where is that Google Plus code running? Commented Dec 31, 2013 at 16:50
  • The angular code is kind of bulky, which is why i didn't put it up at first, but i find that attaching the function to $window as said by CD.. works perfectly, thanks :) Commented Jan 2, 2014 at 15:30

1 Answer 1

3

Try adding renderSignin to the $window instead of the $scope.

$window.renderSignin = function() { ... }

(Don't forget injecting $window into your controller)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.