Skip to content

Select box option [value]'s not being set in NgFor without using NgModel #7975

@brtnshrdr

Description

@brtnshrdr

After beta.14, if you have a select box and you are using an NgFor loop for your options, you can no longer use [value] if you are NOT using [(ngModel)]. (It only sets the "value" attribute on the option element if you are using ngModel). Bug was most likely introduced in #7842

Steps to reproduce and a minimal demo of the problem

http://plnkr.co/edit/vcI7spvX4832scqrkSmo?p=preview

What steps should we try in your demo to see the problem?

If you look at the console, you'll notice that the select box with an ngModel (which is set to a fake object that does NOT exist on the component), it outputs the value option after the (change) event. The select box withOUT the ngModel attribute however, doesn't have the value attribute set, and outputs the display value of the option.

Expected/desired behavior
[value] should work regardless of the presence of an NgModel

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions