【发布时间】:2016-10-06 18:44:30
【问题描述】:
我有以下角脚本,它只是创建一个对象列表:
//To get the existing records
$scope.get_records = function(){
filter_data = {set__iexact: $scope.final_data.set};
bin.get(filter_data,
function(data){
$scope.main_list = data['objects'];
console.log($scope.main_list);
angular.forEach($scope.main_list, function(f) {
});
},function(data, status){
console.log('Stage1: Internal error while loading initial data:'+status );
}
)};
每条记录中唯一的字段是 id。我将这些 id 显示为 HTML 中的表格 (tr)。
<table class="table table paleblue table-fixed">
{%verbatim %}
<tr align="center" ng-repeat="f in main_list" ng-cloak>
<td><button class="btn btn-small">{{f.id}}</button></td>
</tr>
</table>
我的目标是在当前td 下方显示一个表格,该表格仅包含该特定 id 的元素。我怎样才能做到这一点?如何获取该特定 ID,以便我可以将其与 set 一起过滤?有什么想法吗?
【问题讨论】:
-
“我如何获得 id” ...您是说
f.id不正确吗?问题/问题陈述不是很清楚 -
f.id 是正确的。但我需要获取该特定 ID 的对象并显示在表格中。 :)
-
这样做的问题具体是什么?
-
如何获取该特定 id 的表?如何传递该 id 来获取数据
-
ng-click="controllerFunction(f)"
标签: javascript python html angularjs django