Hi Friends,
I am unable to save my form data to firebase. Following is the snap from constructor:
this.billForm = formBuilder.group({
fullname: ['', Validators.compose([Validators.maxLength(30), Validators.pattern('[a-zA-Z ]*'), Validators.required])],
age: ['', AgeValidator.isValid],
email:[null, Validators.compose([Validators.required, Validators.minLength(5), Validators.maxLength(50),Validators.pattern(/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i)])],
mobile:['', Validators.compose([Validators.required, Validators.pattern('^[\+0-9]{10,12}$')])],
purchaseDate:[moment().format()],
dueDate: [moment().add(5, 'days').format()],
location:[],
terms:[false, Validators.required]
});
Additionally, following is the Submit button function:
saveBill(){
if(!this.billForm.valid){
let toast = this.toastCtrl.create({
message: 'Pls fill the details correctly',
duration: 3000
}); toast.present();
} else {
this.firebaseData.saveBill(this.billForm.value.fullname, this.billForm.value.email, this.billForm.value.mobile, this.billForm.value.product, this.billForm.value.quantity, this.billForm.value.rate, this.billForm.value.purchaseDate, this.billForm.value.dueDate, this.billForm.value.location, this.billForm.value.refname, this.billForm.value.refmobile, this.billForm.value.terms).then(()=>{
let toast = this.toastCtrl.create({
message: 'Application submitted successfully!',
duration: 3000
}); toast.present();
})
}
Kindly suggest where I am missing