-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
fix(snack-bar): snack bar not animating in if no positions are passed in #11230
Conversation
I think a better way to tackle this would be to set ensure the defaults are set in the We can do: open(message: string, action: string = '', config?: MatSnackBarConfig):
MatSnackBarRef<SimpleSnackBar> {
const _config = {...new MatSnackBarConfig(), ...this._defaultConfig, ...config};
// Since the user doesn't have access to the component, we can
// override the data to pass in our own message and action.
_config.data = {message, action};
_config.announcementMessage = message;
return this.openFromComponent(SimpleSnackBar, _config);
} This will have our object as the default, while being overridden by whatever the user provides either by provider or at the time |
That's what I was thinking initially. My reasoning for doing it this way is that the purpose of using the injection token in the first place is to be able to change the default values, but by creating a new |
Adds some better handling for the case where no positions are passed into a snack bar. Currently the snack bar attempts to animate in to an invalid animation state. Fixes angular#11197.
66ba197
to
42b1d7c
Compare
I see specifying the default options as overriding the defaults for the ones you provide; anything left unspecified would just be the original default. |
The feedback has been addressed. |
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
… in (angular#11230) Adds some better handling for the case where no positions are passed into a snack bar. Currently the snack bar attempts to animate in to an invalid animation state. Fixes angular#11197.
… in (angular#11230) Adds some better handling for the case where no positions are passed into a snack bar. Currently the snack bar attempts to animate in to an invalid animation state. Fixes angular#11197.
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. |
Adds some better handling for the case where no positions are passed into a snack bar. Currently the snack bar attempts to animate in to an invalid animation state.
Fixes #11197.