IonicPopup.show() - 摇动空值而不是“无”

时间:2015-03-10 20:33:32

标签: css angularjs ionic-framework ionic ionicpopup

我为IonicPopup提供了示例代码,并且我已将修改了wifi密码条目作为用户名和密码条目。它按预期工作,但是如果您在没有输入用户名或密码的情况下单击“登录”按钮,则会发生e.preventDefault()

有没有办法可以在弹出窗口中添加动画,也许是"摇动"动画,如果任一字段留空?

$scope.promptLogin = function() {

    $scope.data = {};

    // An elaborate, custom popup
    var myPopup = $ionicPopup.show({
        template: '<input type="text" placeholder="Username" ng-model="data.user"><br><input type="password" placeholder="Password" ng-model="data.pass">',
        title: 'Enter Credentials',
        subTitle: '',
        scope: $scope,
        buttons: [
        { text: 'Cancel' },
        {
            text: '<b>Login</b>',
            type: 'button-positive',
            onTap: function(e) {
            if (!$scope.data.user || !$scope.data.pass) {
                //don't allow the user to close unless he enters a user and pass
                e.preventDefault();
            } else {
                //console.log($scope.data.user + " - " + $scope.data.pass);
            }
            }
        }
        ]
    });

};

0 个答案:

没有答案