components: mat-select-trigger is invisible if value is undefined or null
Bug, feature request, or proposal:
md-select-trigger
is invisible if value is undefined
or null
when MD_PLACEHOLDER_GLOBAL_OPTIONS
set to { float: 'always' }
(use to show field name)
i cant show ‘All’ or 'Please Select … ’ on the md-select
What is the expected behavior?
need a way to show hint text / empty option alternative text
What is the current behavior?
mat-select-trigger
is invisible if value is undefined
or null
What are the steps to reproduce?
https://stackblitz.com/edit/angular-material2-issue-vyqfqf
What is the use-case or motivation for changing an existing behavior?
use select as a list filter, or form control with a hint text
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 4
- Comments: 17 (6 by maintainers)
now we have mat-label for this
@crisbeto I think you can close this issue
@crisbeto, regarding when to show it: I would strongly argue that if the value for ‘trigger’ is not empty, it should always be displayed. The developer has full control over the value provided to the trigger, and with a simple ‘Placeholder will not display unless the triggerValue is empty’ in the docs, it’s clear enough what needs to be done.
If that is not an option, then it should be one, via a flag.
For a use case, I present a multi-select where ‘No Selection’ is allowed. I would like to display ‘All’, ‘Partial ({{count}})’ or ‘None’. I cannot display None, because the selection is empty thus the (empty) placeholder is displayed instead.
I believe that there is similar issue when the select is multiple and no value is selected: the value is then an empty array, evaluating to a falsy value just as null or undefined…
Please let me know if this deserves another issue or not. I wanted to remain on the less-noisy option by default.
@crisbeto while this is currently intended behavior, is there any wisdom in always rendering the trigger value if
mat-select-trigger
is defined?