forms - 从下一页按下移动返回按钮时,取消离子页面中的 OTP 字段
问题描述
我正在使用离子手机,在手机验证和 otp 验证后,它将进入注册页面。到目前为止,它工作得很好。但是,当按下移动返回按钮时,从注册页面将进入 otp 验证页面,并自动填充 otp。从注册页面回来时,我想清除此 otp 自动填充。
这是我的代码。
<ion-content>
<form [formGroup]="verifyMobile" >
<ion-item>
<ion-label position="floating" >OTP (Sent to your SMS)</ion-label>
<ion-input type="number" formControlName="otp"></ion-input>
</ion-item>
<p>Enter the token sent to your mobile.</p>
<div>
<ion-button >Resend OTP</ion-button>
<ion-button type="submit" (click)="validateOTP()">Verify otp</ion-button>
</div>
</form>
在我添加的 TS 文件中。
submit() {
this.verifyMobile.reset()
}
但是当按下移动返回按钮时,我仍然会自动填充 OTP。
解决方案
推荐阅读
- javascript - 在 UI 中显示不同的字符串
- python - GluonCV 目标检测器 - 批量图像推断
- pentaho - Pentaho Kettle Avro 输入
- java - Java字符串索引让我感到困惑
- sql - cx_Oracle.DatabaseError: ORA-01841: (full) year 必须在 -4713 和 +9999 之间,而不是 0
- java - 字符串中的 NullPointerException
- r - 在 R 中的 shapefile 上绘制空间数据集时,如何绘制空间数据集的坐标?
- python - 如何为自己更改 setter 和 getter 以便能够在 python 中处理类和组合
- java - 错误“未为 User 类型定义带有 DefaultPasswordEncoder() 的方法”Spring Boot 密码
- javascript - 再次使用组件做出反应