question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mat-select-trigger is invisible if value is undefined or null

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:17 (6 by maintainers)

github_iconTop GitHub Comments

8reactions
hsinyu-chencommented, Mar 4, 2019

now we have mat-label for this

<mat-form-field>
    <mat-label>Status</mat-label>
    <mat-select placeholder="Please Select">...</mat-select>
</mat-form-field>

@crisbeto I think you can close this issue

1reaction
ggranumcommented, Jan 11, 2018

@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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

mat-select not showing initially selected item - Stack Overflow
I'm using <mat-select-trigger> in order to display selected items - in ... I've also tried to used [(ngModel)] instead of [(value)] but none...
Read more >
Select | Angular Material
MatSelectTrigger. Allows the user to customize the trigger that is displayed when the select has a value. Selector: mat- ...
Read more >
How do you deal with null vs undefined? - DEV Community ‍ ‍
On the other hand, null is used when you explicitly say that variable points to no value. You know that variable exists, but...
Read more >
UNPKG - @angular/material
n */\n set: function (value) {\n // If the specified tabIndex value is null or undefined, fall back to the default value.\n this._tabIndex...
Read more >
@angular/material-moment-adapter | Yarn - Package Manager
bug fix, input: only set as aria-invalid if the input isn't empty (#21609 (008bf7a246b20f9709c0f82dfb51c3e58a695b07), closes #18140. bug fix, select: value ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found