-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(snack-bar): add the ability to open from a TemplateRef #10268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Allows consumers to open a snack bar through a custom `TemplateRef`, in addition to a component type. Fixes angular#6136.
* @param template Template to be instantiated. | ||
* @param config Extra configuration for the snack bar. | ||
*/ | ||
openFromTemplate(template: TemplateRef<any>, config?: MatSnackBarConfig): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Point for discussion: currently the font size and color styling are attached to the SimpleSnackBar
, which means that consumers that open through openFromComponent
and openFromTemplate
won't get the styling. Should we switch to attaching them on the MatSnackBarContainer
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could do it for templates since its new, but changing it now for components could be seen as a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we should not do it at all, especially if we plan on having it be different between templates and components.
It was done this way as the SimpleSnackBar
is the snack bar that matches the spec and we give users full control with opening a custom snackbar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* @param template Template to be instantiated. | ||
* @param config Extra configuration for the snack bar. | ||
*/ | ||
openFromTemplate(template: TemplateRef<any>, config?: MatSnackBarConfig): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could do it for templates since its new, but changing it now for components could be seen as a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Allows consumers to open a snack bar through a custom
TemplateRef
, in addition to a component type.Fixes #6136.