Uh oh!
There was an error while loading. Please reload this page.
feat(datepicker): allow for mat-datepicker-toggle icon to be customized - #9487
Conversation
| <img matDatepickerToggleIcon src="my-custom-icon.png"> | ||
| </mat-datepicker-toggle> | ||
| <mat-datepicker #myDatepicker></mat-datepicker> | ||
| ``` |
There was a problem hiding this comment.
can you turn this into an embedded example?
| @Directive({ | ||
| selector: '[matDatepickerToggleIcon]' | ||
| }) | ||
| export class MatDatepickerToggleIcon {} |
There was a problem hiding this comment.
Do we need a special directive? what if we just treat any projected content as a custom icon?
There was a problem hiding this comment.
We could, but it gets a little dirtier when you try to figure out whether to hide the default icon. We'd have to loop through all the children of the content element and count the amount of element nodes (skipping comments, text nodes etc.) on every change detection.
There was a problem hiding this comment.
Interesting, I thought there was an easier way to check if any content was projected, but it looks like you're right
Allows for the consumer to set a different icon for the `mat-datepicker-icon` via the `matDatepickerToggleIcon` directive. The reasoning for the change is that not all consumers might be using the Material icons or they may want to set something different (e.g. a chevron).
f18185b to
bff5e19CompareThis 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 for the consumer to set a different icon for the
mat-datepicker-iconvia thematDatepickerToggleIcondirective. The reasoning for the change is that not all consumers might be using the Material icons or they may want to set something different (e.g. a chevron).