在Angular中,我希望select中显示的内容是数组中对象的两个属性的组合。例如,我在项目上有auctionName和auctionLocation,我希望显示中的文本看起来像auctionLocation-auctionName。
<select ng-model="selectedAuction" ng-options="item.auctionLocation as item.auctionLocation for item in auctions">
<option value="" disabled selected>All Auctions</option>
</select>
答案 0 :(得分:1)
值可以在ng-options
内连接。
对于您的情况,您可以使用:
ng-options="item.auctionLocation as item.auctionName+'-'+item.auctionLocation for item in auctions"