简体   繁体   English

我可以知道一种方法来提交数据到 Firebase 而不提交 Angular 8 表格中的“确认密码”字段吗?

[英]Can I know a way to submit data to Firebase without submitting the “Confirm-Password” field in Angular 8 Form?

Below code shows the reset function of my component.ts file.下面的代码显示了我的 component.ts 文件的重置 function。 How can I enter data into the 'student' collection of firebase database without inserting confirm password field如何在不插入确认密码字段的情况下将数据输入到 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);
}

If you have not added the confirm password document to your collection then you can simply remove the confirm password line from your code如果您尚未将确认密码文档添加到您的收藏中,那么您只需从代码中删除确认密码行

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.

相关问题 表单正在提交但未提交 - Form is submitting without submit 如何在不重新加载页面的情况下检查表单中的确认密码字段 - how to check confirm password field in form without reloading page 我的提交表单是在不单击表单的情况下提交数据的 - my submit form isn't submitting data without clicking on form 在Laravel中提交表单之前确认密码 - Confirm the password before a form submit in Laravel 在允许用户提交表单 JS 之前,我如何检查密码是否与确认密码匹配 - How do I check to see is password matches confirm password before user is allowed to submit the form JS 我可以在HTML页面上的表单之间共享数据吗? 还是可以提交一种形式,提交另一种形式? - Can I share data between forms on HTML pages? Or can submitting one form, submit another? 表单数据未在 Angular 中提交 - Form data not submitting in Angular JavaScript 中是否有办法检索 * 将 * 与表单一起发送而不提交的表单数据? - Is there a way in JavaScript to retrieve the form data that *would* be sent with a form without submitting it? 如果我重新加载页面,AJAX表单提交来自浏览器的保存密码,没有“确认表单提交”请求 - AJAX Form submit with save password from browser and no “Confirm form submission” request if I reload the page 如何在不提交表单的情况下获取javascript中输入字段的值? - How can I get the value of an input field in javascript without submitting a form?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM