Skip to content

MatSnackBarConfig.viewContainerRef is not honored #11038

@cl0udninja

Description

@cl0udninja

Bug, feature request, or proposal:

Bug

What is the expected behavior?

When MatSnackBar.open is called with a MatSnackBarConfig like

{
  ...
  viewContainerRef: myContainerRef
  ...
}

according to the documentation:

viewContainerRef: ViewContainerRef       The view container to place the overlay for the snack bar into.

it's overlay of the snackbar should be placed inside the provided container ref.

What is the current behavior?

It's attached directly to <body>

What are the steps to reproduce?

https://stackblitz.com/edit/angular-material2-issue-1jgbvq

What is the use-case or motivation for changing an existing behavior?

I want to show the snackbar inside of a container and not globally

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

Angular: 5.2.9
Material: 5.2.5
OS: MacOS v10.13.3
TypeScript: 2.4.2
Browser: Chrome v65.0.3325.181

Is there anything else we should know?

Nope

Metadata

Metadata

Assignees

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