Skip to content
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

feat(select): add ability to customize the select trigger #3341

Merged
merged 1 commit into from Aug 9, 2017

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Feb 28, 2017

Adds the md-select-trigger directive which allows users to customize the selected value. E.g. it is now possible to do something like this, if the user wanted to reverse the selected label for some reason:

<md-select placeholder="Food" [formControl]="control" #select="mdSelect">
  <md-select-trigger>
    {{ select.selected?.viewValue.split('').reverse().join('') }}
  </md-select-trigger>
  <md-option *ngFor="let food of foods" [value]="food.value">
    {{ food.viewValue }}
  </md-option>
</md-select>

Fixes #2275.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Feb 28, 2017
@fxck
Copy link
Contributor

fxck commented Mar 16, 2017

Any progress on this? I think it could be useful for #2722 (comment)

@fxck
Copy link
Contributor

fxck commented Apr 23, 2017

How's this feature coming? ;)

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 on API / approach

Not sure how this will affect @mmalerba's work

@mmalerba
Copy link
Contributor

mmalerba commented Aug 8, 2017

Is this the equivalent of what md-placeholder is for input? I plan to refactor md-select to work inside md-input-container (which is currently being renamed md-form-field in #6331 ). Once that is done the select can just take advantage of all the placeholder/hint/error features currently available on the input

@crisbeto
Copy link
Member Author

crisbeto commented Aug 8, 2017

Pretty much, It was quite a while ago since I opened this PR.

@crisbeto crisbeto closed this Aug 8, 2017
@fxck
Copy link
Contributor

fxck commented Aug 8, 2017

mm?

@crisbeto
Copy link
Member Author

crisbeto commented Aug 8, 2017

Hmm looking through it again, this won't be the same as the md-placeholder @mmalerba. This allows for the displayed value to be overwritten, not the placeholder. It should probably be called md-select-value though. I'll reopen and rebase it.

@crisbeto crisbeto reopened this Aug 8, 2017
Adds the `md-select-trigger` directive which allows users to customize the selected value. E.g. it is now possible to do something like this, if the user wanted to reverse the selected label for some reason:

```ts
<md-select placeholder="Food" [formControl]="control" #select="mdSelect">
  <md-select-trigger>
    {{ select.selected?.viewValue.split('').reverse().join('') }}
  </md-select-trigger>
  <md-option *ngFor="let food of foods" [value]="food.value">
    {{ food.viewValue }}
  </md-option>
</md-select>
```

Fixes angular#2275.
@crisbeto crisbeto requested a review from kara as a code owner August 8, 2017 18:43
@crisbeto crisbeto changed the title feat(select): add ability to customize the selected value label feat(select): add ability to customize the select trigger Aug 8, 2017
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker and removed pr: needs rebase labels Aug 8, 2017
@mmalerba
Copy link
Contributor

mmalerba commented Aug 9, 2017

@jelbourn does this new name sound good to you?

@crisbeto
Copy link
Member Author

crisbeto commented Aug 9, 2017

We agreed on it in Slack @mmalerba.

@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 6, 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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support template content for selected value in md-select
6 participants