i have following angular script, nothing create list of objects:
//to 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 ); } )};
the unique field in each record id. , displaying these ids table (tr) in html.
<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>
my goal show table below current td
, contains elements of particular id. how can that? how specific id can filter set
? idea?
you must add:
0 - filter: second row have id of other elements filter, in case father row.
<tr align="center" ng-repeat="f in main_list" ng-cloak>
will change
<tr align="center" ng-repeat="f in main_list | filter:{father:selected}" ng-cloak>
1 - set filter: when click id set filter id value, in case click custom link, , set id as
$scope.selected` filter element in other row: father row.
<td><button class="btn btn-small">{{f.id}}</button></td>
will change
<td><a ng-click="$parent.selected=element.id">show sons of {{element.id}}</a></td>
as can see use $parent.selected
. because when in ng-repeat in sub scope of controller scope.
check plunkr: http://plnkr.co/edit/vtsosbfzdpxepg3qw5yn?p=preview