Reference.child failed: First argument was an invalid path

Reference.child failed: First argument was an invalid path = “undefined”. Paths must be non-empty strings and can’t contain “.”, “#”, “$”, “[”, or “]”

any solution with this code…plis help me

import { Component } from ‘@angular/core’;
import { IonicPage, NavController, LoadingController, ToastController, NavParams } from ‘ionic-angular’;
import { UserserviceProvider } from ‘…/…/providers/userservice/userservice’;
import { HomePage } from ‘…/home/home’;

/**

@IonicPage()
@Component({
selector: ‘page-register’,
templateUrl: ‘register.html’,
providers: [UserserviceProvider]
})
export class RegisterPage {

public first_name : any;
public last_name : any;
public email : string;
public password : any;
public phone : any;
public state : any;

constructor(public navCtrl: NavController, public navParams: NavParams,
public usersserviceProvider : UserserviceProvider,
public toastCtrl: ToastController, public loadingCtrl: LoadingController) {
//
}

ionViewDidLoad() {
console.log(‘ionViewDidLoad RegisterPage’);
}

doSignup(){

 var account = {
   first_name: this.first_name,
  last_name: this.last_name,
  email: this.email, 
  password: this.password,
  phone: this.phone,
   state: this.state
 

};

var that = this;

var loader = this.loadingCtrl.create({
content: “Please wait…”,

});
loader.present();


this.usersserviceProvider.signupUserService(account).then(authData => {
	//successful
	loader.dismiss();
	that.navCtrl.setRoot(HomePage);

}, error => {

loader.dismiss();
// Unable to log in
let toast = this.toastCtrl.create({
message: error,
duration: 3000,
position: ‘top’
});
toast.present();

  that.password = ""//empty the password field

});

}
}

Hello,

it is not clear for me what the error cause, but in your code are a few bad habbits and serious timming problems.

Never use any as long it is not needed, use suitable types.
Never use var, as long it is not needed, use let.
In ionic 4 and I assume in ionic 3 it is similar, all (or maybe most) whatever.create(… or .present() returns a promise. Use await with async in function head or promise syntax .then(… In your code you have it on loader and toast that you call with .create and. present asyncrounous code, that never waits before it execute the next code.

Best regards, anna-liebt

image

i want do this…but problem in firebase email and password can get but first name, last name and etc dont get.


sorry this is first time im use…im still newbie…