2015-11-05 79 views
0

我正在使用Ionic和Cordova构建应用程序,并且alertify消息显示正常,但在单击确定时不会关闭。我试图添加onocclick函数来尝试解决问题,但是这没有做任何事情。 这里是我的代码:Alertify.alert未关闭按钮单击

if (($scope.loginData.username==undefined)&&($scope.loginData.password==undefined)){ 
     alertify.alert("You have not entered a username and a password."); 
     return; 
    } 

    else if ($scope.loginData.username==undefined){ 
     alertify.alert("You have not entered a username.").set('label', 'Ok'); 
     return; 
    } 

    else if ($scope.loginData.password==undefined){ 
     alertify.alert("You have not entered a password."); 
     return; 
    } 

回答

0

我想你可能会错过的OnOK方法

'onok': function(){ alertify.success('Great');} 

考虑检查出这个模板的警报

var closable = alertify.alert().setting('closable'); 

alertify.alert() 
    .setting({ 
    'label':'Agree', 
    'message': 'This dialog is : ' + (closable ? ' ' : ' not ') + 'closable.' , 
    'onok': function(){ alertify.success('Great');} 
    }).show(); 
+0

不幸的是,不解决这个问题。 –