HTML
<select ng-model="data.trackId"
ng-value="track.id"
ng-options="track.name for track in tracks">
</select>
在服务器端我正在接收该轨道作为对象。
{ name: 'gadf',
room: 'asdf',
start: '0:55',
end: '0:55',
dayId: 4,
trackId: { id: 3, name: 'track 3', color: '#FFFFCC' },
color: 'gasdf',
description: 'asdf' }
期望:
我想收到trackId为3
答案 0 :(得分:0)
ng-value
没有必要,请尝试:
<select ng-model="data.trackId"
ng-options="track.trackId.id as track.name for track in tracks">
</select>
更新: Demo