I'm following the guide on Angular Material github to set custom global configuration to use on the snackbar module. This is the guide I'm following.
However, as sais in the docs, there is no export for MAT_SNACK_BAR_DEFAULT_OPTIONS
only MAT_SNACK_BAR_DATA
but it's not overriding the default configuration.
This is what I tried:
import { MatSnackBarModule, MAT_SNACK_BAR_DATA } from '@angular/material/snack-bar';
providers: [
{ provide: MAT_SNACK_BAR_DATA, useValue: { duration: 2500 } }
]
I also tried like this:
{ provide: MatSnackBarConfig, useValue: { duration: 2500 } }
{ provide: MatSnackBarConfig, useClass: SnackClass }
But none of the options is working. The snack never auto dismiss after the specified time.
MAT_SNACK_BAR_DEFAULT_OPTIONS
was implemented since6.0.0-beta.4
– Melanite