我将数据显示为表格。用户必须从表中选择一行。所以我尝试使用 <md-radio-button>
, 但它抛出一个错误说 <md-radio-group>
缺少指令。谁能告诉我如何使用 <md-radio-button>
里面有 ng-repeat?
<table md-table>
<thead md-head>
<tr>
<td md-cell></td>
<td md-cell>ID</td>
<td md-cell>Demand</td>
<td md-cell>Code</td>
</tr>
</thead md-head>
<tbody md-body>
<md-radio-group ng-model="test" class="md-primary">
<tr md-row ng-repeat="cluster in clusters">
<td md-cell>
<md-radio-button ng-value="cluster.checked"/>
</td>
<td md-cell>{{cluster.id}}</td>
<td md-cell>{{cluster.demand}}</td>
<td md-cell>{{cluster.code}}</td>
</tr>
</md-radio-group>
</tbody>
</table>
最佳答案
您可以完全按照您的方式在表格中使用 md-radio-group
和 md-radio-button
。您的代码不起作用的原因是不遵守 "always use a dot rule" .
关于javascript - Angular : How to use <md-radio-button> inside <table> with ng-repeat,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40669958/