Skip to content

Mat SnackBar position error and hide #11795

@pacozevallos

Description

@pacozevallos

I am handling errors with MatSnackBar and I have problems with the position in which the dialog is displayed and it is not hidden automatically.

captura de pantalla 2018-06-14 a la s 12 57 01

This is a known behavior?

service.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 });
}

component.ts

facebookLogin() {
  this.auth.facebookLogin()
}

When I test it from the same component, everything works normal:

openSnackBar() {
this.snackBar.open(this.message, this.action, {
  duration: 500,
});
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions