Hello, friends, i had created my mobile app successfully and installed all plugins successfully too.
But when i want to add data to firebase, its not adding data. Please check my codes and let me know what to do.
constructor(
public alertCtrl: AlertController,
public modalCtrl: ModalController,
public navCtrl: NavController,
public toastCtrl: ToastController,
public loadingCtrl: LoadingController
) {
this.messageTable = firebase.database().ref('message');
this.messageKey = this.messageTable.push().key;
}
writesendMessage(messageKey, nameField, emailField, phoneField, commentField){
firebase.database().ref('message/' + messageKey).set({
Name: 'Faisal',
Email: 'emy@gmail.com',
Phone: '1234567890',
Messaage: 'Hello, its just a test message',
});
//This code is adding the data to my database but showing the key as undefined
}
but when i use ngModel variables which are used in form
writesendMessage(messageKey, nameField, emailField, phoneField, commentField){
firebase.database().ref('message/' + messageKey).set({
Name: nameField,
Email: emailField,
Phone: phoneField,
Messaage: commentField
});
} //this code do nothing now, but few hours before it was showing me error.