【发布时间】:2017-08-10 17:30:04
【问题描述】:
我已将 Firebase 用于身份验证。
这是验证码
export class AuthService {
signupUser(email:string,password:string){
firebase.auth().createUserWithEmailAndPassword(email,password).catch((error)=>{
console.log(error);
})
}
这是signup.Component.ts中的注册代码
onSignup(form:NgForm){
const email=form.value.email;
const password=form.value.password;
this.authService.signupUser(email,password);
}
因此,我不想打印错误,而是想抛出一个错误并在注册组件中捕获它,以便我可以使用该错误并向用户显示一条闪存消息。我怎样才能做到这一点?有人可以解决我的问题吗?
【问题讨论】:
标签: angular firebase firebase-realtime-database firebase-authentication