使用AngularJS的Phonegap + Facebook插件

yan*_*ann 5 javascript android facebook angularjs cordova

我想用Javascript开发一个应用程序,并在Android和iOS上使用Phonegap进行部署.我想用Facebook登录我的应用程序.

所以,我查看了phonegap-facebook插件,一切正常(我设法使用FB登录).问题是当我想"试图"插件提供的示例代码时:在index.html中我有JS嵌入这样:

<script>
  // Initialize the Facebook SDK
  document.addEventListener('deviceready', function() {
      FB.init({
          appId: 'XXX',
          nativeInterface: CDV.FB,
          useCachedDialogs: false
      });

      FB.getLoginStatus(handleStatusChange);

      authUser();
      updateAuthElements();
  });
</script>
Run Code Online (Sandbox Code Playgroud)

调用的js方法直接更新显示(使用document.getElementById).我想在我的index.html和javascript代码之间创建一个绑定,以便使用类似的东西打印facebook令牌和名称

{{user.token}} and {{user.names}}
Run Code Online (Sandbox Code Playgroud)

有人设法意识到这样的事情吗?

非常感谢!

Yar*_*atz 0

这有用吗?

angular.element('[ng-controller=<name of the controller>]').scope().user = {token: <the extracted token>, names: <the extracted names>}
Run Code Online (Sandbox Code Playgroud)