Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 反复重新打开同一警报_Javascript_Angularjs_Ionic Framework_Ionic3 - Fatal编程技术网

Javascript 反复重新打开同一警报

Javascript 反复重新打开同一警报,javascript,angularjs,ionic-framework,ionic3,Javascript,Angularjs,Ionic Framework,Ionic3,我正在申请离子3。注册页面中有验证otp功能。当用户单击“注册”按钮时,将打开一个警报,带有带有“取消”、“验证”和“重新发送”按钮的otp输入。当用户单击“重新发送”按钮时,我想做的是打开相同的警报。我通过在“重发”按钮处理程序中复制整个警报代码来实现这一点。但它只是第一次开张。我想在用户单击“重新发送”按钮时无限期重新打开此警报 下面是我的警报代码 { let alert = this.alertCtrl.create({ title: 'OTP Sent. Verify OTP'

我正在申请离子3。注册页面中有验证otp功能。当用户单击“注册”按钮时,将打开一个警报,带有带有“取消”、“验证”和“重新发送”按钮的otp输入。当用户单击“重新发送”按钮时,我想做的是打开相同的警报。我通过在“重发”按钮处理程序中复制整个警报代码来实现这一点。但它只是第一次开张。我想在用户单击“重新发送”按钮时无限期重新打开此警报

下面是我的警报代码

{

let alert = this.alertCtrl.create({
    title: 'OTP Sent. Verify OTP',
    inputs: [{
        name: 'otp',
        placeholder: 'OTP',
        value: this.otp
    }, ],
    buttons: [{
            text: 'Cancel',
            role: 'cancel',
            handler: data => {
                console.log('Cancel clicked');
            }
        },
        {
            text: 'Verify',
            handler: data => {
                console.log(data.otp);
                if (this.responseData.data.otp_sent == data.otp) {
                    console.log("verfiied");
                } else {
                    // invalid login
                    return false;
                }
            }
        },
        {
            text: 'Resend',
            handler: data => {
                this.authService.postData('mobile=' + this.responseData.data.mobile, 'user/resend').then((result) => {
                    // console.log(this.otpResend);
                    let alert = this.alertCtrl.create({
                        title: 'OTP Sent. Verify OTP',
                        inputs: [{
                            name: 'otp',
                            placeholder: 'OTP',
                            value: this.otp
                        }, ],
                        buttons: [{
                                text: 'Cancel',
                                role: 'cancel',
                                handler: data => {
                                    console.log('Cancel clicked');
                                }
                            },
                            {
                                text: 'Verify',
                                handler: data => {
                                    console.log(data.otp);
                                    if (this.responseData.data.otp_sent == data.otp) {
                                        console.log("verfiied");
                                    } else {
                                        // invalid login
                                        return false;
                                    }
                                }
                            },
                            {
                                text: 'Resend',
                                handler: data => {
                                    this.authService.postData('mobile=' + this.responseData.data.mobile, 'user/resend').then((result) => {
                                        // console.log(this.otpResend);

                                    });
                                }
                            }
                        ]
                    });
                    alert.present();

                });
            }
        }
    ]
});
alert.present();
}
进行重新发送功能

    resend(){

         this.authService.postData('mobile=' + this.responseData.data.mobile, 'user/resend').then((result) => {
                                // console.log(this.otpResend);
                                let alert1 = this.alertCtrl.create({
                                    title: 'OTP Sent. Verify OTP',
                                    inputs: [{
                                        name: 'otp',
                                        placeholder: 'OTP',
                                        value: this.otp
                                    }, ],
                                    buttons: [{
                                            text: 'Cancel',
                                            role: 'cancel',
                                            handler: data => {
                                                console.log('Cancel clicked');
                                            }
                                        },
                                        {
                                            text: 'Verify',
                                            handler: data => {
                                                console.log(data.otp);
                                                if (this.responseData.data.otp_sent == data.otp) {
                                                    console.log("verfiied");
                                                } else {
                                                    // invalid login
                                                    return false;
                                                }
                                            }
                                        },
                                        {
                                            text: 'Resend',
                                            handler: data => {
                                                this.authService.postData('mobile=' + this.responseData.data.mobile, 'user/resend').then((result) => {
                                                    resend();
                                                    // console.log(this.otpResend);

                                                });
                                            }
                                        }
                                    ]
                                });
                                alert1.present();

    }
那就叫它

 {
            text: 'Resend',
            handler: data =>{
              resend();
            }
}
进行重新发送功能

    resend(){

         this.authService.postData('mobile=' + this.responseData.data.mobile, 'user/resend').then((result) => {
                                // console.log(this.otpResend);
                                let alert1 = this.alertCtrl.create({
                                    title: 'OTP Sent. Verify OTP',
                                    inputs: [{
                                        name: 'otp',
                                        placeholder: 'OTP',
                                        value: this.otp
                                    }, ],
                                    buttons: [{
                                            text: 'Cancel',
                                            role: 'cancel',
                                            handler: data => {
                                                console.log('Cancel clicked');
                                            }
                                        },
                                        {
                                            text: 'Verify',
                                            handler: data => {
                                                console.log(data.otp);
                                                if (this.responseData.data.otp_sent == data.otp) {
                                                    console.log("verfiied");
                                                } else {
                                                    // invalid login
                                                    return false;
                                                }
                                            }
                                        },
                                        {
                                            text: 'Resend',
                                            handler: data => {
                                                this.authService.postData('mobile=' + this.responseData.data.mobile, 'user/resend').then((result) => {
                                                    resend();
                                                    // console.log(this.otpResend);

                                                });
                                            }
                                        }
                                    ]
                                });
                                alert1.present();

    }
那就叫它

 {
            text: 'Resend',
            handler: data =>{
              resend();
            }
}

它只调用一次所以需要递归调用…它只调用一次所以需要递归调用。。。。。