we want store uniqe incident id for each incident stored in firebase
this on server page
add_incident(pro) {
console.log(pro)
return this.afs.collection('Incident').add(pro);}
this on addincudent.ts
async savecase(){
let pro = {
incidentid:this.incidentid,
civilid:this.civilid,
incidentdate:this.incidentdate,
};
if(this.incidentid && this.civilid && this.incidentdate)
{
const loading= await this.loadingCtrl.create({
message:"loading---",
spinner:"crescent",
showBackdrop:true
});
loading.present();
this.auth.add_incident(pro).then(resp => {
this.incidentid = "";
this.civilid = "";
this.incidentdate = "";
console.log(resp);
loading.dismiss();
this.toast('save Success!','success'); this.router.navigate(['/incidentpage']);
})
.catch(error => {
console.log(error);
});
}