我正在尝试使用 ng-repeat 制作一个表格,该表格在每行的开头都有一个单选按钮选择器。该表如下所示:
<table>
<tbody>
<tr ng-repeat="model in modelList">
<td>
<input type="radio" ng-model="model.select"></input>
</td>
<td>{{ model.NDPName }}</td>
<td>{{ model.OEM }}</td>
<td>{{ model.version }}</td>
<td>{{ model.dateAdded }}</td>
<td>{{ model.validUntil }}</td>
</tr>
</tbody>
</table>
ng-repeat 取自一个看起来像这样的模型列表:
$scope.modelList =
[
{
select: false,
NDPName: "NDP1",
OEM: "CHOAM Inc.",
version: "01",
dateAdded: "Jan 1, 2013",
validUntil: "Jan 1, 2014",
},
{
select: false,
NDPName: "NDP2",
OEM: "Tyrell Corp.",
version: "01",
dateAdded: "Jan 1, 2014",
validUntil: "Jan 1, 2015",
},
{
select: false,
NDPName: "NDP3",
OEM: "Stark Industries",
version: "01",
dateAdded: "Jan 1, 2015",
validUntil: "Jan 1, 2016",
},
{
select: false,
NDPName: "NDP4",
OEM: "Monsters Inc.",
version: "01",
dateAdded: "Jan 1, 2016",
validUntil: "Jan 1, 2017",
},
{
select: false,
NDPName: "NDP5",
OEM: "ACME Corp",
version: "01",
dateAdded: "Jan 1, 2017",
validUntil: "Jan 1, 2018",
}
];
我遇到的问题是单选按钮的行为不像单选按钮。它们每个都在一个单独的范围内,因此将允许选择表中的多行。我怎样才能解决这个问题?