使用AngularJS的谷歌登录按钮
我正在尝试用AngularJS创建一个Google连接按钮 我是这样说的: 我在index.html中加载了platform.js,但该文件包含一个显示另一个html模板的ng视图 然后使用AngularJS的谷歌登录按钮,angularjs,google-api,Angularjs,Google Api,我正在尝试用AngularJS创建一个Google连接按钮 我是这样说的: 我在index.html中加载了platform.js,但该文件包含一个显示另一个html模板的ng视图 然后 试试这个插件 用法 包括google-plus-signin.js 将directive.g+signin添加为应用程序的依赖项 添加到你的应用程序 在$scope for event:google plus sign success上创建一个侦听器,以检测用户何时通过身份验证 可选:侦听事件:google
试试这个插件
用法
<div ng-app="directive.g+signin">
<google-plus-signin clientid="620125449078"></google-plus-signin>
<p>^ This is a Google Plus sign-in button</p>
</div>
$scope.$on('event:google-plus-signin-success', function (event,authResult) {
// Send login to server or save into cookie
});
$scope.$on('event:google-plus-signin-failure', function (event,authResult) {
// Auth failure or signout detected
});
^这是一个Google Plus登录按钮
$scope.$on('event:google plus signin success',函数(event,authResult){
//将登录名发送到服务器或保存到cookie中
});
$scope.$on('event:google plus signin failure',函数(event,authResult){
//检测到身份验证失败或注销
});
我几个小时前确实找到了它,但它不起作用。事实上,现在我花时间去探索它,经过一些定制后,它开始工作了。谢谢你的回答当我使用这个时,我收到一个错误,上面写着“online未定义”,然后我不得不在代码中根据这个拉取请求在online周围添加引号。。。