[英]Can I know a way to submit data to Firebase without submitting the “Confirm-Password” field in Angular 8 Form?
下面的代碼顯示了我的 component.ts 文件的重置 function。 如何在不插入確認密碼字段的情況下將數據輸入到 firebase 數據庫的“學生”集合中
ngOnInit() {
this.resetForm();
}
resetForm(form?:NgForm){
if(form !=null)
form.reset();
this.user={
Email:'',
Password:'',
IndexNumber:'',
ConfirmPassword:''
onSubmit(form:NgForm){
let data=form.value;
this.firestore.collection('student').add(data);
this.resetForm(form);
}
如果您尚未將確認密碼文檔添加到您的收藏中,那么您只需從代碼中刪除確認密碼行
ngOnInit() {
this.resetForm();
}
resetForm(form ? : NgForm) {
if (form != null)
form.reset();
this.user = {
Email: '',
Password: '',
IndexNumber: '',
ConfirmPassword: '' //Remove This
onSubmit(form: NgForm) {
let data = form.value;
this.firestore.collection('student').add(data);
this.resetForm(form);
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.