googlearchive / generator-angularfire

Yeoman generator for AngularFire: Angular + Firebase apps
190 stars 52 forks source link

createUserWithEmailandPassword Failed: first argument "email" must be a valid string. #73

Closed asifaathwal closed 6 years ago

asifaathwal commented 6 years ago

Hello i am using firebase auth and i am facing this issue

createUserWithEmailandPassword Failed: first argument "email" must be a valid string.

registration.html

`

Registration Form
# registration.ts @IonicPage() @Component({ selector: 'page-registration', templateUrl: 'registration.html', }) export class RegistrationPage { @ViewChild('email') email; @ViewChild('password') password; constructor(private alertCtrl: AlertController, private fire: AngularFireAuth, public nav: NavController, public navParams: NavParams) { } ionViewDidLoad() { console.log('ionViewDidLoad RegistrationPage'); } alert(message: string) { this.alertCtrl.create({ title: 'Info!', subTitle: message, buttons: ['OK'] }).present(); } signup() { this.fire.auth.createUserWithEmailAndPassword(this.email.value, this.password.value) .then(data => { console.log('got data ', data); console.log(this.email); this.alert(' Succesfully Registered!'); }) .catch(error => { console.log('got an error ', error); this.alert(error.message); }); console.log('Would register user with ', this.email.value, this.password.value); } } `