material icon indicating copy to clipboard operation
material copied to clipboard

select: ng-options not supported

Open leibale opened this issue 11 years ago • 78 comments

$scope.options = [1,2,3];
<!-- Working -->
<select ng-options="option in options"></select>
<!-- Not working -->
<md-select ng-options="option in options"></md-select>

leibale avatar Mar 09 '15 12:03 leibale

Try:

<md-select ng-model="thing">
  <md-option ng-repeat="option in options"></md-option>
</md-select>

prestonvanloon avatar Mar 09 '15 21:03 prestonvanloon

i know this option, but i like the second option

leibale avatar Mar 09 '15 21:03 leibale

For now this isn't supported.

rschmukler avatar Mar 23 '15 16:03 rschmukler

@rschmukler why not just use the ng-options model?

ilanbiala avatar Mar 23 '15 22:03 ilanbiala

@ilanbiala I'd accept a PR with it, otherwise ng-repeat works and there are higher priorities.

rschmukler avatar Mar 24 '15 00:03 rschmukler

Reopening, as it is a valid issue for the backlog.

rschmukler avatar Apr 01 '15 21:04 rschmukler

@rschmukler Would you target just a "copy" of current "ng-options" directive to support md-select? I assume we would need "md-options" for this as "ng-options" is tightly connected to "select" directive?

skosno avatar Jun 16 '15 15:06 skosno

By supporting ng-options, would this fix the problem with not being about to set the value to null? Currently, with the following code, choosing the first option will update the model with an empty string instead of null.

<md-select ng-model="vm.leaderId">
  <md-option value="">Unknown</md-option>
  <md-option ng-value="leader.id" ng-repeat="leader in vm.leaders">{{leader.name}}</md-option>
</md-select>

The AngularJS docs say: Optionally, a single hard-coded <option> element, with the value set to an empty string, can be nested into the <select> element. This element will then represent the null or "not selected" option.

So, using angular's <select>, I can select a null value by providing this option: <option value="">Unknown</option>

I would assume that I should be able to do the same with <md-select><md-option>

sherrim avatar Jul 08 '15 15:07 sherrim

+1.

md-select with ng-repeat doesn't update model, whereas ng-options updates the model. Need ng-options for md-select

sspatrudu avatar Jul 28 '15 23:07 sspatrudu

+1

blxs avatar Jul 30 '15 10:07 blxs

+1

mfjohansson avatar Aug 22 '15 16:08 mfjohansson

+1

schervenkov avatar Aug 28 '15 19:08 schervenkov

+1

ghost avatar Sep 09 '15 02:09 ghost

+1

frikkievb avatar Sep 23 '15 08:09 frikkievb

+1

Wingie avatar Oct 04 '15 10:10 Wingie

+1

interstella-5555 avatar Oct 05 '15 10:10 interstella-5555

+1

Yes, I need this! I want the model to update so I can work with the selected option in the controller.

yodiyo avatar Oct 07 '15 08:10 yodiyo

+1

lorthirk avatar Oct 16 '15 12:10 lorthirk

+1

ghost avatar Oct 18 '15 22:10 ghost

+1

jml6m avatar Oct 20 '15 21:10 jml6m