0

I have a select box with a list of Employees. when i select one it is sending the string value to the controller. I need to pass the Id of the selected name, not the name value itself. plunker

 <label>CustomerPM:</label>
 <select style="width: 150px" ng-options="customer.CustomerEmployeeFirstName + ' ' + customer.CustomerEmployeeLastName as customer.CustomerEmployeeFirstName + ' ' + customer.CustomerEmployeeLastName for customer in customerEmployeeArray | filter:{CustomerEmployeeRole : 'PM', CustomerId : currentItem.CustomerId}" ng-model="currentItem.CustomerEmployeePMId"> 
   <option value="" selected="selected">Select</option>
      &nbsp;
   </select><br />
     {{currentItem.CustomerEmployeePMId}}<br />
      <label>CustomerSuper:</label>
   <select style="width: 150px" ng-options="customer.CustomerEmployeeFirstName + ' ' + customer.CustomerEmployeeLastName as customer.CustomerEmployeeFirstName + ' ' + customer.CustomerEmployeeLastName for customer in customerEmployeeArray | filter:{CustomerEmployeeRole : 'Super', CustomerId : currentItem.CustomerId} " ng-model="currentItem.CustomerEmployeeSuperId">
     <option value="" selected="selected">Select</option>
       &nbsp;
    </select><br />
    {{currentItem.CustomerEmployeeSuperId}}<br/>
texas697
  • 5,609
  • 16
  • 65
  • 131

1 Answers1

1

Remove the first part of your ng-options attribute, customer.CustomerEmployeeFirstName + ' ' + customer.CustomerEmployeeLastName as -- and replace it with customer.CustomerEmployeeId as

From the docs:

select: The result of this expression will be bound to the model of the parent element. If not specified, select expression will default to value.

Blazemonger
  • 90,923
  • 26
  • 142
  • 180