我正尝试使用Angularjs(使用Ionic Framework)通过Google OAuth2从我的Phonegap应用程序登录.目前我正在使用http://phonegap-tips.com/articles/google-api-oauth-with-phonegaps-inappbrowser.html进行登录.但它正在创建看起来非常难看的代码和非常难以理解的代码我正在使用Angular-UI-Router for Ionic.
如果没有任何正确的答案,这个问题似乎正在蔓延.我希望现在应该解决.Google Angular Guys应该会有所帮助. 如何在phonegap中实施Google Auth?
最接近的主题是如何使用带有Cordova/Phonegap的Google Login API,但这不是angularjs的解决方案.
我不得不使用以下代码传输javascript变量值:
var el = document.getElementById('test');
var scopeTest = angular.element(el).scope();
scopeTest.$apply(function(){
scopeTest.user = user;
scopeTest.logged_in = true;
scopeTest.name = user.name;
scopeTest.email = user.email;
});
Run Code Online (Sandbox Code Playgroud)