-
Notifications
You must be signed in to change notification settings - Fork 27.4k
ng-value and select elements #7994
Comments
|
Hmm - I guess last night I was thinking |
Technically <select>
<option ng-value="names[0]">{{names[0]}}</option>
//value = pizza
</select> A PR to the docs would be good to clarify this. |
+1 This doesn't seem to work as advertised for booleans. See this Plunker: http://plnkr.co/1Nf5xCNBYBvEyRHMvHhI I cannot get the OPTIONS to deal in booleans. It keeps switching the type to a string? |
It is impossible to create an `input[select]`, so it appears the intention here was actually `option`. Fixes angular#7994
It is impossible to create an `input[select]`, so it appears the intention here was actually `option`. Fixes angular#7994
Hi Narretz, Can you please clarify how this relates to 'doesn't work with booleans' (see my Plunker above). Or is there now a separate issue for that? Regards, Richard. |
@kennardconsulting |
@Narretz yes, I would be happy to. Before I do, however, could you please clarify my question (as it is related to the documentation you just modified). The question is: when you use
...will always return |
@kennardconsulting |
Note that the documation for |
Correction: only using |
@Narretz thanks for investigating this for me. I think you have identified the source of confusion: some parts of Angular support values other than strings, others not. 'Pure' html does not support boolean radio buttons, but Angular does (as you said). Is there not an approach that will allow a select box of booleans? |
You can use |
Much appreciated. Thanks. |
According to the documentation (https://docs.angularjs.org/api/ng/directive/ngValue),
ng-value
should work with select elements but that's not the case. If you change the plunker in the example to be a select box "unicorn" does not end up selected.The text was updated successfully, but these errors were encountered: