Bug
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.
It's attached directly to <body>
https://stackblitz.com/edit/angular-material2-issue-1jgbvq
I want to show the snackbar inside of a container and not globally
Angular: 5.2.9
Material: 5.2.5
OS: MacOS v10.13.3
TypeScript: 2.4.2
Browser: Chrome v65.0.3325.181
Nope
I was told when i brought this issue up that the option described is only to change the order of change detection ... not display.
I have the following: https://stackblitz.com/edit/angular-material-tooltip-in-container-fbuspp?file=app%2Fapp.module.ts
where you can change the display of a snackbar
If that's the case the documentation should say so IMHO. But it states otherwise. Thank you for your example I'll be sure to check it out. I'd love to use the built in component over my custom one!
@tmburnell I can actually see and open your snackbar after I put the application in full screen as well.
In my example if you did not have my could you would not be able to see the snack bar without the logic. So mine allows you to still see it because I scope it to a div.
Ah I see your point.
Closing as this is working as intended, the ViewContainerRef
determines the snackbars placement in the angular logic tree, it does not have any bearing on its location in the DOM tree.
@josephperrott Can you at least update the ambiguous documentation? Because the documentation says the place in the logic tree, it says 'The view container to place the overlay for the snack bar into.' And that's totally not happening.
@josephperrott I would vote for a documentation change as well. Got fooled by the current documentation as well.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
@josephperrott Can you at least update the ambiguous documentation? Because the documentation says the place in the logic tree, it says 'The view container to place the overlay for the snack bar into.' And that's totally not happening.