我有以下按钮:
<button id="facebook" type="button" ng-disabled="signing" ng-click="fblogin()">FACEBOOK</button>
<button id="google" type="button" ng-disabled="signing" ng-click="googleLogin()">GOOGLE</button>
例如,当我按下Google按钮时,它会执行以下操作:
$scope.googleLogin = function() {
$scope.signing = true;
document.getElementById('googleAuth').click();
};
我的gapi这样做:
gapi.load('auth2', function(){
// Retrieve the singleton for the GoogleAuth library and set up the client.
auth2 = gapi.auth2.init({
client_id: 'MY ID',
cookiepolicy: 'single_host_origin',
scope: 'email',
// Request scopes in addition to 'profile' and 'email'
//scope: 'additional_scope'
});
attachSignin(document.getElementById('googleAuth'));
});
该按钮被禁用,这很棒,因为我将$scope.signing
更改为TRUE。
但是当我回来时,我这样做:$scope.signing = false;
并且没有任何变化,按钮保持禁用状态。当我将签名更改为false时,为什么不启用它,我是否需要让html知道某种方式刷新按钮的状态?
答案 0 :(得分:0)
感谢Surajck,我把它设置为$ apply,就像这样:
$scope.$apply(function () {
$scope.signing = false;
});