AngularJS orderBy filter not working as expected -


i'm trying show array ($scope.stored_questions_clusters) sorted in descending order position of each element, problem don't desired result.

in example ng-repeat = "question cluster stored in clusters questions | orderby '- question_cluster.position'", @ each iteration create panel bootstrap print position, expect list sorted position, don't this...

here code use:

<div style="margin-top:30px;" ng-show="mostrarpreguntas==true">   <div ng-repeat="question_cluster in stored_questions_clusters |  orderby:'-question_cluster.position'" class="col-xs-8 col-xs-offset-2">     <div class="panel panel-default">       <div class="panel-heading">         <div class="row">           <div class="col-xs-11">             <h3>{{question_cluster.position}}.- {{question_cluster.title}}</h3>               </div>                  .                  .                  . 

and result:

sort_by_error

this console.log of each element:

enter image description here

you want use ng-repeat="question_cluster in stored_questions_clusters | orderby:'-position'"

this sort question_clusters in descending order

have @ first example on angulars order documentation


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -