离子otp验证问题无法识别otp

时间:2019-09-24 08:00:46

标签: angular ionic-framework ionic2 ionic4

otp无法识别。 otp显示为无效凭据。我正在使用离子警报控制器来获取otp。后端无法识别otp。在后端和错误响应中显示为undefined。如何解决这个问题。有什么方法可以在警报控制器中使用ngModel绑定。

html

noun1 = input("Give the first proper noun: ")
noun2 = input("Give the second proper noun: ")
print("The words together form: = "+noun1+noun2)

.ts

<div class="floating-label">
    <input placeholder="Email" type="email" id="email" name="Email" [(ngModel)]="Email">
    <label for="email">Email</label>
    <div class="floating-label">
        <input placeholder="Mobile" type="Mobile" id="mobileno" name="Mobile" [(ngModel)]="Mobile">
        <label for="email">Mobile</label>
        <div class="btn-sec">
            <button type="submit" (click)="Continue(Mobile,Email)">Continue</button>
        </div>
    </div>
</div>

service.ts

    async Continue(Mobile, Email) {

        const user = {
            Mobile: Mobile,
            Email: Email,
        }
        console.log(Mobile);
        console.log(Email);
        this.api.SignupUser(user).subscribe(data => {
            console.log(data);
        });
        this.alert1 = await this.alertCtrl.create({
                header: 'OTP',
                message: 'Please Enter your Otp sent to your Mobile Number',

                inputs: [{
                    name: 'otp',
                    value: 'otp'


                }],
                buttons: [{
                        text: 'Cancel',
                        role: 'cancel'
                    },
                    {
                        text: 'ConfirmOTP',
                        handler: () => {
                            var user1 = {
                                Mobile: this.Mobile,
                                Email: this.Email,
                                otp: this.otp
                            };
                            console.log(user1);
                            this.api.Verifyotp(user1).subscribe(data => {
                                console.log(data);
                                this.data = data;
                                if (this.data.Msg) {
                                    alert(this.data.Msg);
                                } else {
                                    this.router.navigate(['/']);
                                }

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

0 个答案:

没有答案