Skip to content

docs-bug(COMPONENT): Update snack-bar global config for standalone components #31718

@Vladi-ed

Description

@Vladi-ed

Documentation Feedback

Documentation suggests to add MAT_SNACK_BAR_DEFAULT_OPTIONS to ngModule, but not in the case of standalone component.
If you add this provide to standalone component it seems to be not working...

@NgModule({
  providers: [
    {provide: MAT_SNACK_BAR_DEFAULT_OPTIONS, useValue: {duration: 2500}}
  ]
})
@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrl: './app.component.scss',
    standalone: true,
    providers: [{provide: MAT_SNACK_BAR_DEFAULT_OPTIONS, useValue: { verticalPosition: "top" }}],
    imports: [...]
})

Affected documentation page

https://material.angular.dev/components/snack-bar/overview#setting-the-global-configuration-defaults

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsThis issue is related to documentationneeds triageThis issue needs to be triaged by the team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions