【发布时间】:2016-12-12 04:11:42
【问题描述】:
我需要在复选框单击时选择表格中的一行并在 div 上显示选定的行值,因为我是 angularjs 的新手,无法弄清楚它是如何完成的。 我尝试使用过滤器选项,但没有工作,请协助任何感谢。
我的代码
<table ng-show="ad_tabl==1" id="data" border="1" class="table table-striped responsive-utilities jambo_table bulk_action" >
<thead>
<tr class="headings">
<th><input type="checkbox" class=""/></th>
<th>Index X 10 table1</th>
<th>Steps</th>
<th>Distance(ft)</th>
<th>Distance....(m)</th></th>
</tr>
</thead>
<tbody>
<tr ng-repeat="ad1 in action_distance" >
<td class="a-center ">
<input ng-model="ad1.index" type="checkbox" class="tableflat_ad"/>
</td>
<td>{{ad1.index}}</td>
<td>{{ad1.steps}}</td>
<td>{{ad1.distance_ft}}</td>
<td>{{ad1.distance_m}}</td>
</tr>
</tbody>
</table>
<div>
//////// show row selected value here ///////////
</div>
var app = angular.module('formExample', [])
.controller('ExampleController', ['$scope', function($scope) {
$scope.action_distance = [
{
index:"0",
steps: "<=2 in.(5cm.)",
distance_ft: "",
distance_m: "",
},{
index: "1",
steps: "Within Reach",
distance_ft: "",
distance_m: "",
},{
index: "3",
steps: "1-2 Steps",
distance_ft: "",
distance_m: "",
}
];
}]);
提前致谢。
【问题讨论】: