Skip to content

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

Merged
merged 1 commit into from
Mar 6, 2018

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Mar 5, 2018

Allows consumers to open a snack bar through a custom TemplateRef, in addition to a component type.

Fixes #6136.

Allows consumers to open a snack bar through a custom `TemplateRef`, in addition to a component type.

Fixes angular#6136.
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Mar 5, 2018
* @param template Template to be instantiated.
* @param config Extra configuration for the snack bar.
*/
openFromTemplate(template: TemplateRef<any>, config?: MatSnackBarConfig):
Copy link
Member Author

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?

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

@jelbourn jelbourn left a 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):
Copy link
Member

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.

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker target: major This PR is targeted for the next major release and removed pr: needs review labels Mar 5, 2018
Copy link
Member

@josephperrott josephperrott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jelbourn jelbourn merged commit c44e253 into angular:master Mar 6, 2018
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement target: major This PR is targeted for the next major release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support of ng-template for SnackBar
4 participants