0
我有一个带有员工列表的选择框。当我选择一个它将字符串值发送到控制器。我需要传递所选名称的Id,而不是名称值本身。 plunker如何在选择框中显示对象的ID
<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>
</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>
</select><br />
{{currentItem.CustomerEmployeeSuperId}}<br/>
我没有看到'
[This question](http://stackoverflow.com/questions/12139152/how-to-set-value-property-in-angularjs-ng-options)应该是相关的。 – rlecaro2 2014-10-20 18:59:09