-
Notifications
You must be signed in to change notification settings - Fork 27.5k
ngValue ignored in ng-content and ng-template #26273
Copy link
Copy link
Open
Labels
area: formsfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under considerationfreq2: medium
Milestone
Description
Activity
Metadata
Metadata
Assignees
Labels
area: formsfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under considerationfreq2: medium
I'm submitting a...
This issue was previously reported at #22374, which was closed as a support request even though I don't believe it was intended to be one.
Current behavior
ngValueis ignored if (1) the<option>s are provided via<ng-content>to a component (even if the component simply wraps a vanilla<select>) or (2) if the<option>s are in an<ng-template>.Expected behavior
ngValueshould work the same in these cases as it does when using a plain<select>with directly nested<option>s.Minimal reproduction of the problem with instructions
Please see https://codesandbox.io/s/2z2n2v0pjp .
Here is a screenshot of the reproduction:
What is the motivation / use case for changing the behavior?
Many applications require a custom-styled
<select>component that allow the caller of the component to provide their own<option>s.Environment