我希望用户通过其用户ID保存到firebase。
这是我的注册码。
我不知道这里是否缺少允许用户拥有唯一访问权限的内容?
export class SignupPage {
signupData = {
email: '',
password: '',
passwordRetyped: ''
};
constructor(private navCtrl: NavController, private navParams: NavParams, private alertCtrl: AlertController,
private afAuth: AngularFireAuth) {
this.signupData.email = this.navParams.get('email');
}
signup() {
if(this.signupData.password !== this.signupData.passwordRetyped) {
let alert = this.alertCtrl.create({
title: 'Error',
message: 'Your password and your re-entered password does not match each other.',
buttons: ['OK']
});
alert.present();
return;
}
// Firebase Signup Code
this.afAuth.auth.createUserWithEmailAndPassword(this.signupData.email, this.signupData.password)
.then(auth => {
// Could do something with the Auth-Response
console.log(auth);
})
.catch(err => {
// Handle error
let alert = this.alertCtrl.create({
title: 'Error',
message: err.message,
buttons: ['OK']
});
alert.present();
});
}
}