1
<table class="table table-striped">
<thead>
<tr>
<th class="col-md-1">Name</th>
</tr>
</thead>
<tbody>
<tr reportrowgroup="" ng-repeat="report in reporttree track by $index | orderBy:sortBy" report="report" rowindex="index" class="ng-scope ng-isolate-scope">
<td><a href="#">Marcos Dima</a></td>
(etc...)
這是下拉ORDERBY:
<select class="pull-right" ng-model="sortBy">
<option value="createdAt">Sort by: <strong>Date</strong></option>
<option value="adminRealname">Sort by: <strong>Username</strong></option>
</select>
在reporttree
(樣品)含量:
[
{
"createdAt": "2015-08-12T13:06:54.901Z",
"adminRealname": "Marcos Dima",
},
{
"createdAt": "2015-12-12T13:06:54.901Z",
"adminRealname": "Another name",
},
(etc...)
但是,當我從下拉列表中選擇adminRealname
或createdAt
時 發生。難道我做錯了什麼?
編輯:
該表是一個指令,它是在一個單獨的表。也許這就是問題所在?
' </tr>'+
'</thead>'+
' <tbody>'+
' <!-- <tr ng-repeat="report in reporttree track by $index"> -->'+
' <tr reportrowgroup ng-repeat="report in reporttree | orderBy:sortBy" report="report" rowindex="index"></tr>'+
' </tbody>'+
'<!-- </div> -->'+
'</table>'
嘗試orderBy:'sortBy' – Gianmarco
您的下拉菜單和表屬於同一個控制器嗎?所以這兩個引用山姆實體sortBy。 –
只要你的的{{adminRealname}}格式 – Jax