[英]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.