A form has 2 fields, a selector and a (sometimes) non editable input field. When the user selects something in the selector both fields are filled. The selector shows a date-time and a related label goes to the non editable field. To make the selection more user friendly I need to display in the selector dropdown the data-time concatenated with the label to allow the user to chose the rigth option if two options have the same date but different label. The problem is that after the user chooses an option then the selected value in the selector should have just the date and not the label (this is just shown in its own field). I have added two images to make it clear.
This is the Session Group dropdown with the concatenated date-time and label:
When a value is selected the label should be removed from the display value, since it is shown in the Thermal Profile field:
The ng-options code of the selector looks like this:
ng-options="opt.id as ((opt.sessions_datetime | date:'short') + ' (' + (opt.thermal_profiles_label || '') + ')') for opt in selectors.sessions_groups"
How can the label be added only when the dropdown is displayed, but not when the selector shows the selected value?
I have created a simplified Plunker here:
https://plnkr.co/edit/aDVOFuojDhFSV15BdPU0?p=preview
Note: AngularJS 1.5.0