This post is highly ranked when searching for this, "issue", so I'd like to provide a little more detail.
By the reasoning above shouldn't we get a null value in this example: http://jsfiddle.net/8MYjx/ We get a value of "", which is not consistent with the other use case above. This is still a source of confusion in 1.2.5. I would also say that a value="" isn't "no entry", it is a default entry that plays well with client side validation. On Wednesday, February 13, 2013 11:10:49 AM UTC-5, Pete Bacon Darwin wrote: > > In angular the convention is that an input with no entry has a null model. > If "" is a valid option then why not add it to the list if options > provided by ng-option? > > Pete > ...from my mobile. > On Feb 13, 2013 1:01 PM, "Dave Merrill" <[email protected] <javascript:>> > wrote: > >> Does this strike anyone else as unexpected behavior, i.e., a bug? The >> option value is explicitly empty string, not null. >> >> Peter, your fix is clever and works, but it's remedial, restoring the >> normal behavior of HTML.You could attach that same directive to ngOptions >> instead, so it's used always, but it seems to me like this should be fixed >> in Angular core. >> >> Dave Merrill >> >> On Wednesday, February 13, 2013 5:47:29 AM UTC-5, Peter Bacon Darwin >> wrote: >>> >>> You can "fix" it with a $parser... >>> >>> http://jsfiddle.net/CB5um/ >>> >>> >>> On 13 February 2013 10:27, Henrik Johansson <[email protected]> wrote: >>> >>>> Hi, >>>> >>>> I'm wondering if it's possible to have a >>>> >>>> <select ng-model="query.city" ng-options="..."><option >>>> value="">-empty</option></select> >>>> >>>> >>>> That when "-empty" is selected makes query.city be '' (empty string) >>>> instead of null. Am I missing something? >>>> >>>> I've put together a jsfiddle to show what I mean: http://jsfiddle.net/ >>>> Qcyj7/7/ >>>> >>>> Thanks! >>>> Henrik >>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "AngularJS" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To post to this group, send email to [email protected]. >>>> Visit this group at http://groups.google.com/group/angular?hl=en-US. >>>> For more options, visit https://groups.google.com/groups/opt_out. >>>> >>>> >>>> >>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "AngularJS" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected]<javascript:> >> . >> Visit this group at http://groups.google.com/group/angular?hl=en-US. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/groups/opt_out.
