2016-05-13 11 views
3

NG-繰り返しでangularjsにあなたのアイデア、なぜ動作しないorderBy'-nbtickets'を持っているのですか?私のcontrolerでORDERBYそれは働いていない理由を私は理解していない

<ul ng-repeat="item in customarray | orderBy:'-nbtickets' track by $index"> 
    <li ui-sref="app.usersingle({id:item[0].id,iterate:1})" class="row organization"> 
     <div class="col-md-2 classement text-center">{{$index+1}}</div> 
     <div class="name col-md-4 text-center">{{item[0].username}}</div> 
     <div class="col-md-2 total text-center">{{item[0].nbtickets}}</div> 
     <div class="col-md-2 maintenance text-center">{{item[0].tickmaintenance}}</div> 
     <div class="col-md-2 assistance text-center">{{item[0].tickassistance}}</div> 
    </li> 
    </ul> 

私はちょうどそれを行う:ここ

$scope.customarray = data;

配列

は私がやってそれを表示する{{アイテム}}(preatty大きい私の配列の解析)

[ 
    {"username":"Eugenie Martin","tickassistance":4,"tickbug":0,"tickmaintenance":3,"nbtickets":7,"id":660302971,"tickets":[{"date":"2015-09-29T07:12:14Z","titre":"Changement date de clôture dossier Barbe Alain","status":"closed","tag":"maintenance"}, 
    {"date":"2015-09-04T09:45:20Z","titre":"43325- NH DISTRIBUTION","status":"closed","tag":"assistance"}, 
    {"date":"2015-08-20T06:18:04Z","titre":"TR: EURL NH DISTRIBUTION vous a envoyé un message depuis sa plateforme","status":"closed","tag":"assistance"},{"date":"2015-02-25T16:00:46Z","titre":"Votre demande au support sans suite","status":"closed","tag":"assistance"}, 
    {"date":"2015-01-12T06:48:35Z","titre":"Bonjour,\n\nle cabinet AUFICOM aura un stand lors du...","status":"closed","tag":"assistance"}, 
    {"date":"2014-12-18T09:48:38Z","titre":"ISACOMPTA","status":"closed","tag":"maintenance"},{"date":"2014-12-15T14:08:08Z","titre":"changement date de clôture","status":"closed","tag":"maintenance"}], 
    "monthly":[{"now11":0,"assist":0,"maint":0}, 
    {"now10":0,"assist":0,"maint":0}, 
    {"now9":1,"assist":1,"maint":0}, 
    {"now8":2,"assist":1,"maint":1}, 
    {"now7":0,"assist":0,"maint":0}, 
    {"now6":0,"assist":0,"maint":0}, 
    {"now5":0,"assist":0,"maint":0}, 
    {"now4":0,"assist":0,"maint":0}, 
    {"now3":0,"assist":0,"maint":0}, 
    {"now2":0,"assist":0,"maint":0}, 
    {"now1":0,"assist":0,"maint":0}, 
    {"now":0,"assist":0,"maint":0}]}, 
    [{"date":"2015-09-29T07:12:14Z","titre":"Changement date de clôture dossier Barbe Alain","status":"closed","tag":"maintenance","id":660302971,"name":"Eugenie Martin"}, 
    {"date":"2015-09-04T09:45:20Z","titre":"43325- NH DISTRIBUTION","status":"closed","tag":"assistance","id":660302971,"name":"Eugenie Martin"}, 
    {"date":"2015-08-20T06:18:04Z","titre":"TR: EURL NH DISTRIBUTION vous a envoyé un message depuis sa plateforme","status":"closed","tag":"assistance","id":660302971,"name":"Eugenie Martin"}, 
    {"date":"2015-02-25T16:00:46Z","titre":"Votre demande au support sans suite","status":"closed","tag":"assistance","id":660302971,"name":"Eugenie Martin"}, 
    {"date":"2015-01-12T06:48:35Z","titre":"Bonjour,\n\nle cabinet AUFICOM aura un stand lors du...","status":"closed","tag":"assistance","id":660302971,"name":"Eugenie Martin"}, 
    {"date":"2014-12-18T09:48:38Z","titre":"ISACOMPTA","status":"closed","tag":"maintenance","id":660302971,"name":"Eugenie Martin"}, 
    {"date":"2014-12-15T14:08:08Z","titre":"changement date de clôture","status":"closed","tag":"maintenance","id":660302971,"name":"Eugenie Martin"}] 
]; 
+0

あなたはJSON配列またはコントローラのコードをしたい、あなたのコントローラのコード –

+0

@Stark Buttowskiを示して? – moskitos

+0

両方が意味する場合は、簡単に解決策を得るために –

答えて

0

試しましたか?

<ul ng-repeat="item in customarray | orderBy:'nbtickets':true track by $index"> 

上記:true一部であり、角度orderByで逆オプションがあります。

+1

ちょうど私はこれを行うことでそれを作る: 'orderBy:item [0] .nbtickets:true' – moskitos

+0

あなたは私の答えを受け入れるべきだった笑 – cfz42

+0

@ cfz42逆の宣言はどこですか? – thepio

0

orderBy:-item[0].nbticketsを試しましたか?

+0

それはうまくいきますが、逆の方法ではないので、それは私のような順序です:2,3,4、私は4,3,2が必要ですアイデア ? – moskitos

+0

'orderBy:item [0] .nbtickets'? – cfz42

関連する問題