我正在处理Matsnakbar的错误,我对对话框的显示位置有问题,而且它不会自动隐藏。
服务ts
facebookLogin() {
const provider = new firebase.auth.FacebookAuthProvider();
return this.oAuthLogin(provider);
}
private oAuthLogin(provider) {
return this.afAuth.auth.signInWithPopup(provider)
.then((credential) => {
this.pushUserData(credential.user)
this.router.navigate(['/userProfile'])
})
.catch(error => {
this.handleError(error);
});
}
private handleError(error: Error) {
console.error(error);
this.snackBar.open(error.message, this.action, { duration: 1000 });
}
组成部分ts
facebookLogin() {
this.auth.facebookLogin()
}
当我从同一个组件测试时,一切正常:
openSnackBar() {
this.snackBar.open(this.message, this.action, {
duration: 500,
});
}